<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;A0cERnY5cCp7ImA9WhBbEEs.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754</id><updated>2013-05-09T05:10:07.828+02:00</updated><category term="Libros" /><category term="Visual Studio" /><category term="Microsoft" /><category term="MVC" /><category term=".SCRUM" /><category term="MVVM" /><category term="SQL" /><category term="Delegados y Eventos" /><category term="Formacion" /><category term="Juan Quijano" /><category term="Windows7" /><category term=".MadNug" /><category term="dateTime.toBinary" /><category term=".NET .C# .Mobile .Mobile6.5" /><category term="Azure" /><category term="WowHistory" /><category term="XAML" /><category term="ASP.NET" /><category term="Testing" /><category term="Windows Phone" /><category term="SAP" /><category term="VSTO" /><category term="Opinion" /><category term="EF 4.0" /><category term="ALM" /><category term="VS2012" /><category term="ElBruno" /><category term="Geeks.ms" /><category term=".CMMI" /><category term=".Agile" /><category term="Ajax.net" /><category term=".Kanban" /><category term="reuniones" /><category term="CSS" /><category term="Javascript" /><category term="TFS" /><category term="GridView" /><category term="SharePoint" /><category term="WPD" /><category term="WP7" /><category term="GenbetaDev" /><category term="Coaching" /><category term="SharePoint 2010" /><category term="ReportingServices" /><category term="IIS" /><category term="TFS2008" /><category term="Google" /><category term="#madriagil" /><category term="JQUERY" /><category term="Windows 2012 Server" /><category term="PHP" /><category term="DateTime" /><category term="Combos" /><category term="Agile" /><category term="Linq" /><category term=".NET .C#" /><category term="Linux" /><category term="Scrum" /><category term="eventos" /><category term="MySql" /><category term="GDI+" /><category term="Technical Rangers" /><category term="WPF" /><category term="Entity Framework" /><category term=".NET" /><category term="Excel" /><title>Un poquito de todo</title><subtitle type="html">El objetivo principal es compartir mis experiencias en la programación y gestión de proyectos de software, pero también un poco un sitio donde desahogarme y poder soltar tres o cuatro pensamientos que me llenan la cabeza a veces.

Osea, lector, no esperes maravillas.  Aquí hay solo un hombre que se escribe así mismo.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://1poquitodtodo.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>250</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/CeSv" /><feedburner:info uri="blogspot/cesv" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DU4ASX86eyp7ImA9WhBUFUU.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-9182182005180844603</id><published>2013-05-03T15:31:00.001+02:00</published><updated>2013-05-03T15:32:28.113+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-03T15:32:28.113+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technical Rangers" /><category scheme="http://www.blogger.com/atom/ns#" term="Formacion" /><category scheme="http://www.blogger.com/atom/ns#" term="eventos" /><title>Mesa redonda "Cómo mejorar nuestras capacidades de comunicación", Abril 2013.</title><content type="html">&lt;p&gt;Ha pasado casi un mes desde la celebración de este evento, &lt;strong&gt;mi primer evento como organizador y promotor&lt;/strong&gt;, y no había tenido tiempo para dejar reposar lo aprendido y poder hacer una crónica sobre lo ocurrido. &lt;p&gt;Primero, y antes que nada, darles las gracias a &lt;strong&gt;David Salgado y Vanesa Pizarro&lt;/strong&gt; por apuntarse como ponentes a la primera. Gastar un sábado por la mañana y de forma totalmente altruista, merece mucho más que un fuerte aplauso. &lt;p&gt;A continuación, y no por ello menos agradecido, un gran gracias a &lt;strong&gt;Pablo Carballude&lt;/strong&gt; que consiguió la sala en las instalaciones en Microsoft, el parking, y que ejerció de anfitrión para los que fuimos al evento. &lt;p&gt;Por último, agradecer mucho a los asistentes: &lt;strong&gt;Bruno Capuano, Victor González, Juan María Laó Ramos – &lt;em&gt;&lt;u&gt;que se vino desde Sevilla&lt;/u&gt;&lt;/em&gt; -, Roberto Luis Bisbé&lt;/strong&gt; y el presente que escribe estas líneas (a mí mismo no me agradezco, que queda mal). &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-ptdWylkB-ko/UYO8IJKBu-I/AAAAAAAACog/8tNyYDwe3kc/s1600-h/WP_20130406_001%25255B4%25255D.jpg"&gt;&lt;img title="WP_20130406_001" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="WP_20130406_001" src="http://lh5.ggpht.com/-CPDvxcpc__M/UYO8J5GutQI/AAAAAAAACok/sxR1xxfJUSc/WP_20130406_001_thumb%25255B1%25255D.jpg?imgmax=800" width="644" height="364"&gt;&lt;/a&gt; &lt;p&gt;La charla la inició Salgado, que no solamente fue interesantísima si no que se pudo alargar en el tiempo hasta quedar saciados de sabiduría por parte de&lt;strong&gt; uno de los mejores speakers del panorama técnico&lt;/strong&gt; en España. &lt;p&gt;En mi caso me ha causado una epifanía que me ha llevado a plantearme que ciertamente quiero mejorar mi capacidad de compartir mis conocimientos y experiencias en público. &lt;p&gt;Una hora y media después arranco Vanesa, Community Manager profesional, que nos explicó de forma sencilla las técnicas que ayudarán a nuestros post a obtener un SEO lo más positivo posible. Incluyendo una plantilla que en Weblog SL, donde escribo, la utilizamos; pero que ella &lt;strong&gt;me ha dado buenas ideas que he puesto en acción&lt;/strong&gt; y mejoran aún más la posición y visibilidad de mis artículos. &lt;p&gt;Por último, y en los últimos quince minutos, nos plantamos delante de Pablo,&lt;strong&gt; como coordinador y responsable del programa de Technical Rangers&lt;/strong&gt;, y le planteamos varias dudas que nos estaban reconcomiendo desde hace tiempo. &lt;p&gt;La conclusión ha sido sencilla, a pesar de lo que parece, &lt;strong&gt;Microsoft no va a cerrar el programa&lt;/strong&gt;.  &lt;p&gt;El programa va a recibir un potente impulso en los próximos trimestres una vez que MS relaje la presión sobre Windows 8.  &lt;p&gt;Se va a realizar una criba en el programa para que nos quedemos los que se adhieran a la Visión del programa: &lt;b&gt;difundir el ecosistema de Microsoft desde un punto de vista técnico&lt;/b&gt;. Y así darles más valor a los miembros del programa, y que ser Technical Rangers no sea un mero “&lt;i&gt;título&lt;/i&gt;” sin sentido, si no el reconocimiento de un buen trabajo. &lt;p&gt;Por último recibimos la buena noticia de que Devify.es no será el único sitio de reporte, que Pablo y David han reconocido que es muy incómodo y poco funcional. Y que están trabajando en &lt;b&gt;una forma automatizada de obtener el ranking de cada TR&lt;/b&gt; y su aportación. &lt;p&gt;Mientras ha pasado un mes y el programa ha vuelto al “&lt;i&gt;limbo&lt;/i&gt;”, por lo cual este es el artículo que marca el regreso a mi empuje personal (porque me da la gana y me apetece) del programa y que se plasmará en unos pocos días en otra &lt;b&gt;Acción en Conjunto&lt;/b&gt;. &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-0Vu_2Bk9rtE/UYO8ZYF3dRI/AAAAAAAACow/IjLSPLjcrCY/s1600-h/WP_20130406_002%25255B4%25255D.jpg"&gt;&lt;img title="WP_20130406_002" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="WP_20130406_002" src="http://lh5.ggpht.com/-2hPfQXQ5urk/UYO8aW0EeBI/AAAAAAAACo4/DMdlOzmMo8E/WP_20130406_002_thumb%25255B1%25255D.jpg?imgmax=800" width="644" height="364"&gt;&lt;/a&gt; &lt;p&gt;Si eres un Technical Ranger, y estás leyendo estas líneas... &lt;b&gt;ponte las pilas&lt;/b&gt; (si te apetece, claro).   &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/D6VzPbNDc-o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/9182182005180844603/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=9182182005180844603" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/9182182005180844603?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/9182182005180844603?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/D6VzPbNDc-o/mesa-redonda-mejorar-nuestras.html" title="Mesa redonda &amp;quot;Cómo mejorar nuestras capacidades de comunicación&amp;quot;, Abril 2013." /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-CPDvxcpc__M/UYO8J5GutQI/AAAAAAAACok/sxR1xxfJUSc/s72-c/WP_20130406_001_thumb%25255B1%25255D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2013/05/mesa-redonda-mejorar-nuestras.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08ASX89fyp7ImA9WhBXE00.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7301245742714513420</id><published>2013-03-26T13:43:00.001+01:00</published><updated>2013-03-26T13:44:08.167+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-26T13:44:08.167+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><title>Excel Reader, una excelente dll para manejar ficheros Excel xls</title><content type="html">&lt;p&gt;Estoy metido en una aplicación que importa datos desde una Excel, los desmenuza y los inserta/actualiza en una base de datos SQL.&lt;/p&gt; &lt;p&gt;Como ya me he encontrado anteriormente con el dolor de trabajar con las Interop, me puse a buscar algo más sencillo y me encontré con un proyecto en &lt;a href="http://www.codeproject.com/Articles/16210/Excel-Reader" target="_blank"&gt;Code Project de Liu Junfeng, del 2009&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Así de una forma mucho más sencilla puedo leer de libro que quiera, la fila y la celda oportuna.&lt;/p&gt; &lt;p&gt;Y no pongo un ejemplo, porque en la propia página vas a tener uno tan sencillo como el que estoy utilizando yo, y que cubre las necesidades de mi proyecto.&lt;/p&gt; &lt;p&gt;Espero que sea tan útil como lo ha sido para mí.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/P3H5thEBLik" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7301245742714513420/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7301245742714513420" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7301245742714513420?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7301245742714513420?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/P3H5thEBLik/excel-reader-una-excelente-dll-para.html" title="Excel Reader, una excelente dll para manejar ficheros Excel xls" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2013/03/excel-reader-una-excelente-dll-para.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IBQH49eSp7ImA9WhBQGUk.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-2619343153728309665</id><published>2013-03-22T11:13:00.001+01:00</published><updated>2013-03-22T11:52:31.061+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-22T11:52:31.061+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="XAML" /><title>XAML, ajustar el tamaño de la página durante el diseño</title><content type="html">&lt;p&gt;Este es uno de esos inconveniente que se producen cuando se está aprendiendo y aún se es bastante ignorante sobre la tecnología que utilizo.&lt;/p&gt; &lt;p&gt;Trabajando en Visual Studio 2012, para una preciosa aplicación WPF con XAML, me encuentro que el compañero que ha realizado el diseño del interfaz ha bindeado el alto y ancho de las páginas.&lt;/p&gt; &lt;p&gt;Esto está muy bien para que se ajuste el tamaño a todo tipo de pantalla o dispositivo, pero tiene el inconveniente de que tiene dos efecto secundarios muy molestos:&lt;/p&gt; &lt;p&gt;1. El diseñador de Visual Studio le pone un ancho y alto prácticamente infinito y no hay forma de manipular de forma interactiva las pantallas.&lt;/p&gt; &lt;p&gt;2. Al estar calculando constantemente el inabarcable tamaño, cualquier actuación en el diseñador se hace con una lentitud insoportable.&lt;/p&gt; &lt;p&gt;¿Cual es la solución? &lt;strong&gt;Utilizar el tamaño en diseño&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;Es decir, le indico al contenedor principal, en este caso una Page, que quiero que durante el diseño el tamaño de la misma sea lo suficientemente pequeño para ser editable. Y esto lo hago con las siguientes 4 líneas en el XAML que he separado con un salto de línea:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Page &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="TSA_KMSPanel.View.ImportacionKMS"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.openxmlformats.org/markup-compatibility/2006"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/expression/blend/2008"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Ignorable&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="d"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;DesignWidth&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="600" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;DesignHeight&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="800"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Gestion Listado Estatus" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="PageGestionListadoEstatus" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;FontSize&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="14"&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Primero hago la referencia al esquema xml de Blend en su versión 2008.&lt;/li&gt; &lt;li&gt;A continuación le digo que el prefijo del esquema “d” sea ignorado por el compilador. Si no haces esto VS2012 te avisa que no encuentra lo siguiente en el esquema y no te deja continuar, aunque en la realidad funciona perfectamente.&lt;/li&gt; &lt;li&gt;Le añado dos propiedades del esquema “d” que indican el ancho y alto de la página durante el diseño&lt;br&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Y con esto no solamente ahora puedo diseñar de forma visual mi pantalla, si no que la velocidad de manipulación ahora es más que aceptable.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/R19zVNEVpN8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/2619343153728309665/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=2619343153728309665" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/2619343153728309665?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/2619343153728309665?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/R19zVNEVpN8/xaml-ajustar-el-tamano-de-la-pagina.html" title="XAML, ajustar el tamaño de la página durante el diseño" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2013/03/xaml-ajustar-el-tamano-de-la-pagina.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcFR305eyp7ImA9WhBSF0Q.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-3392535091520760975</id><published>2013-02-25T14:11:00.001+01:00</published><updated>2013-02-25T14:13:36.323+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-25T14:13:36.323+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Google" /><title>Exportar un StreamWriter a texto con acentos y ñ</title><content type="html">&lt;p&gt;Manda narices que a estas alturas y con los lustros de picar código que llevo aún me pegue con los acentos y letras como la ñ al ir a exportar datos de la pantalla a un fichero de texto.&lt;/p&gt; &lt;p&gt;Así tengo un StreamWriter que bebe de un Grid, y que quiero guardar todos sus datos como un CSV (fichero de texto separados los valores por punto y coma, para ser abierto directamente dese una Excel).&lt;/p&gt; &lt;p&gt;Me volví loco intentando codificar directamente los valores que estaba añadiendo al StreamWriter, cuando lo que realmente hay que hacer es codificar el objeto stream en sí mismo.&lt;/p&gt; &lt;p&gt;Primero voy a poner la solución y luego, por si le valiera a alguien, el ejemplo completo de exportar el contenido de un objeto DataGrid de WPF a un fichero csv que se pueda abrir desde Excel.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sw = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;StreamWriter&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(rutaFichero, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;false&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Encoding&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.UTF8);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Y con esto consigo que los acentos y la letra ñ me salgan perfecto en Excel.&lt;/p&gt; &lt;p&gt;Ahora el código completo:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;public void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Exportar_a_csv(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataGrid &lt;/span&gt;&lt;span style="background: white; color: black"&gt;pDgHistorial)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(pDgHistorial.IsNotNull())&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sw = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;StreamWriter&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(rutaFichero, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;false&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Encoding&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.UTF8);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;separador = &lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;";"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;foreach &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataGridColumn &lt;/span&gt;&lt;span style="background: white; color: black"&gt;columna &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;pDgHistorial.Columns)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(columna.Header);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(separador);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(sw.NewLine);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;foreach &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;registro &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;pDgHistorial.Items)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;historial = (&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ClaseAlmacenadaEnElGrid&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)registro;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(historial.PrimerCampo&lt;/span&gt;&lt;span style="background: white; color: black"&gt;));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(separador);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(historial.SegundoCampo);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Write(sw.NewLine);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Flush();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sw.Close();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Y ahora explico dos cosas que tienes que tener muy en cuenta:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;El objeto de WPF DataGrid, te almacena objetos tipados. A diferencia del GridView de asp.net. Así lo que recupero son una colección de objetos de una clase específica que he tenido que definir en el momento de la carga de datos en el control. En este caso &lt;span style="background: white; color: #2b91af"&gt;ClaseAlmacenadaEnElGrid.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;El parámetro RutaDelFichero, puede ser un string o, lo ideal, que lo recuperes del app.config de la aplicación.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Espero que resulte útil.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/HKt8pHDSS88" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/3392535091520760975/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=3392535091520760975" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3392535091520760975?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3392535091520760975?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/HKt8pHDSS88/exportar-un-streamwriter-texto-con.html" title="Exportar un StreamWriter a texto con acentos y ñ" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2013/02/exportar-un-streamwriter-texto-con.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UCR3Y8cCp7ImA9WhBSF0U.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-4972878299623728069</id><published>2013-02-25T11:47:00.001+01:00</published><updated>2013-02-25T11:47:46.878+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-25T11:47:46.878+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><title>ConfigurationSettings.AppSettings está obsoleto</title><content type="html">&lt;p&gt;Pequeña tontería que quiero compartir.&lt;/p&gt; &lt;p&gt;Un compañero en una aplicación ha utilizado el siguiente código para acceder a claves den el fichero de configuración app.config:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;NombreFichero = ConfigurationSettings.AppSettings.Get(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"FicheroExportar"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;TipoFichero = ConfigurationSettings.AppSettings.Get(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"TipoFicheroExportar"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Lo cual hace que salte una alarma en Visual Studio avisándote que este código es obsoleto y que lo cambies por el actual.&lt;/p&gt; &lt;p&gt;La duda viene a que no es tan directo como el llamar a un nuevo namespace y ya está, pero vamos a empezar por eso:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Configuration;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Esto no nos dará error alguno, pero si intentas introducir &lt;span style="background: white; color: #2b91af"&gt;ConfigurationManager&lt;/span&gt; en el Intellisense no te vá a salir. Para ello debes hacer referencia del ensamblado adecuado en el proyecto, para lo cual pulso con el botón derecho encima del proyecto principal y escojo “Add Reference”.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-YqE-gikIt1Y/UStBRSLtCmI/AAAAAAAACms/8xQhXRQmpRQ/s1600-h/image%25255B4%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-blsevA_AOiU/UStBTI0TaEI/AAAAAAAACm0/2hUlnSwK7As/image_thumb%25255B2%25255D.png?imgmax=800" width="244" height="224"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Se me abre la ventana para seleccionar el ensamblado adecuado: System.Configuration. Fíjate que estoy en .NET 4.0.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-oEcMKhO0vOs/UStBTlWqPqI/AAAAAAAACm8/kQ60-2IA7EQ/s1600-h/image%25255B9%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-foz4Jyz3mXk/UStBUXNIhgI/AAAAAAAACnA/eTfPonVqnj0/image_thumb%25255B5%25255D.png?imgmax=800" width="244" height="169"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Pulso aceptar y ahora si que si puedo utilizar el código correcto:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;nombreFichero = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ConfigurationManager&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.AppSettings[&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"FicheroExportar"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;];&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;tipoFichero = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ConfigurationManager&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.AppSettings[&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"TipoFicheroExportar"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Espero que sea útil.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/UqpKk3It9D4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/4972878299623728069/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=4972878299623728069" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4972878299623728069?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4972878299623728069?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/UqpKk3It9D4/configurationsettingsappsettings-esta.html" title="ConfigurationSettings.AppSettings está obsoleto" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-blsevA_AOiU/UStBTI0TaEI/AAAAAAAACm0/2hUlnSwK7As/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2013/02/configurationsettingsappsettings-esta.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcMRH84cCp7ImA9WhBTEUk.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-3720510698527116004</id><published>2013-02-06T10:48:00.001+01:00</published><updated>2013-02-06T10:48:05.138+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-06T10:48:05.138+01:00</app:edited><title>Recuperar un valor de un elemento de un XDocument</title><content type="html">&lt;p&gt;Que XML no es santo de mi devoción, como tampoco lo es JavaScript, es algo que destila en todo el blog. Y no lo es ninguna de las dos tecnologías por la misma razón, no son nada amigables en su aprendizaje.&lt;/p&gt; &lt;p&gt;Así me encuentro con la siguiente respuesta de un Webservice, que es básicamente un XmlElement con el body del mensaje SOAP en el innerXML.&lt;/p&gt; &lt;p&gt;&amp;lt;soap:Body xmlns:soap="&lt;a href="http://schemas.xmlsoap.org/soap/envelope/&amp;quot;"&gt;http://schemas.xmlsoap.org/soap/envelope/"&lt;/a&gt;&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;reactiveSecureClientResponse xmlns="&lt;a href="http://irdeto.com/pisys/secureclient&amp;quot;"&gt;http://irdeto.com/pisys/secureclient"&lt;/a&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reactiveSecureClientResult&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;code&amp;gt;1028&amp;lt;/code&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;message&amp;gt;OK&amp;lt;/message&amp;gt;&lt;/strong&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reactiveSecureClientResult&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/reactiveSecureClientResponse&amp;gt;&lt;br&gt;&amp;lt;/soap:Body&amp;gt;&lt;/p&gt; &lt;p&gt;Del cual quiero extraer el valor de los elementos hijos code y message, y que he resaltado en negrita.&lt;/p&gt; &lt;p&gt;Pues bién, llevo casi 6 horas probando mil métodos y la primera aproximación, antes de refactorizarlo – y que va a ser otro artículo – es un tanto extravagante:&lt;/p&gt; &lt;p&gt;Primero convierto el XmlElement en un XDocument (cuidadín con liarte y utilizar XmlDocument, que se montan unos líos de aupa si mezclamos Linq to SQL con XmlDocumentde .NET).&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: #2b91af"&gt;XDocument &lt;/span&gt;&lt;span style="background: white; color: black"&gt;documento = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XDocument&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Parse(cuerpoDelMensajeSoap.InnerXml);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;¿Porqué XDocument.Parse() en vez de el conocido documento.LoadXml()? Ni idea, pero creo que es para joder. Porque ya me contarás porqué algo tan lógico como lo segundo lo cambian por algo tan raro (un constructor estático con parámetros) como lo primero.&lt;/p&gt; &lt;p&gt;A continuación tiro de las capacidades de Linq to XML para hacer una búsqueda que, personalmente, me parece rara de narices:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: #2b91af"&gt;XElement &lt;/span&gt;&lt;span style="background: white; color: black"&gt;code = (&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;from &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XElement &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;documento.Descendants()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;where &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento.Name.LocalName.Equals(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"code"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;select &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento).FirstOrDefault();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;El primer problemón que me encontré es que, a pesar de lo que dicta el sentido común, los xmlElemento que obtengo de los descendientes del XDocument (documento.Descendants()) componen su nombre con dos partes diferenciadas: el namespace y el nombre del nodo en sí.&lt;/p&gt; &lt;p&gt;&amp;lt;{&lt;a href="http://irdeto.com/pisys/secureclient&amp;quot;"&gt;http://irdeto.com/pisys/secureclient&lt;/a&gt;}code&amp;gt;1028&amp;lt;/code&amp;gt;&lt;br&gt;&lt;/p&gt; &lt;p&gt;Osea, que no solo hay que buscar por el Name del elemento, si no también por su nombre Local.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;where &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento.Name.LocalName.Equals(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"code"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;Y así, y entonces si, podemos cargar el valor del nodo de marras que quería recuperar. Por cierto, te aconsejo comprobar primero si el XElement no es nulo para evitar una excepción por objeto no instanciado al querer recuperar el Value.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;codigo = (code != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;) ? code.Value : &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Empty;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;Ahora a refactorizar, que me “huele mal” cuando me tengo que traer dos valores,&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;ExtraerRespuestaDelBody(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XmlElement &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cuerpoDelMensajeSoap)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XDocument &lt;/span&gt;&lt;span style="background: white; color: black"&gt;documento = &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XDocument&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Parse(cuerpoDelMensajeSoap.InnerXml);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XElement &lt;/span&gt;&lt;span style="background: white; color: black"&gt;code = (&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;from &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;XElement &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;documento.Descendants()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;where &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento.Name.LocalName.Equals(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"code"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;select &lt;/span&gt;&lt;span style="background: white; color: black"&gt;xmlElemento).FirstOrDefault();&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;codigo = (code != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;) ? code.Value : &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Empty;&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;codigo;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/tY1xTQOc-TI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/3720510698527116004/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=3720510698527116004" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3720510698527116004?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3720510698527116004?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/tY1xTQOc-TI/recuperar-un-valor-de-un-elemento-de-un.html" title="Recuperar un valor de un elemento de un XDocument" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2013/02/recuperar-un-valor-de-un-elemento-de-un.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cASHs9eip7ImA9WhNVEE0.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-8099809036781340785</id><published>2012-12-20T14:10:00.001+01:00</published><updated>2012-12-20T14:10:49.562+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-20T14:10:49.562+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ALM" /><category scheme="http://www.blogger.com/atom/ns#" term="TFS" /><title>Migrando de TFS11Beta a TFS2012 with Update 1</title><content type="html">&lt;p&gt;Ha llegado el momento ineludible y me pongo a migrar un TFS11Beta de producción – si, ya sé que no debiera – a un TFS2012.&lt;/p&gt; &lt;p&gt;Primer escollo, no se puede instalar un TFS2012 actualizando un TFS11 Beta. Hay que desinstalar el TFS11Beta antes. Lo cual – menos mal que tengo todo en máquinas virtuales – implica hacer una backup en forma de snapshot de la máquina virtual.&lt;/p&gt; &lt;p&gt;Segundo escollo &lt;strong&gt;NO SE PUEDE ACTUALIZAR HASTA UN TFS2012 con UPDATE1&lt;/strong&gt;… debes primero actualizar al TFS2012 y después aplicarle el Update1.&lt;/p&gt; &lt;p&gt;Asegurado que no voy a perder más de una hora en volver al punto anterior, desinstalo el TFS11 Beta. Y, sin necesidad de reiniciar la máquina, me pongo a instalar desde la Web el TFS2012.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-nquRGSK6GtU/UNMN6tPYOmI/AAAAAAAACjQ/5FykTn7VqlI/s1600-h/image%25255B45%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-Ib5RIvuWtpY/UNMN78WeRzI/AAAAAAAACjY/aH6WybQjw94/image_thumb%25255B21%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Al instalar el .NET 4.5 pide un reinicio inmediato… es decir que se reinicia en cuanto pulses OK. Al volver al sistema continua guardando en local los ficheros de instalación. &lt;em&gt;(Tal vez debiera haberme tirado del todo al rio y haber actualizado el Windows 2008 server R2 a un Windows 2012 Server, lo cual puede dar para otro artículo)&lt;/em&gt;. Y, finalmente se pone a instalar – sin preguntarme aún si quiero actualizar.&lt;/p&gt; &lt;p&gt;Me pide el número de serie, y cómo no lo tengo a mano, le digo que me ponga un Trial de 90 días. A lo cual me abre el Configuration Center y selecciono &lt;em&gt;Upgrade&lt;/em&gt; y &lt;em&gt;Start Wizard&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-lLMuMdQMswI/UNMN8mgy_jI/AAAAAAAACjg/WTRBNmBVMHo/s1600-h/image%25255B7%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-BwoI5aI66jk/UNMN97PzB1I/AAAAAAAACjo/aQhCU06R-gA/image_thumb%25255B3%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Lo primero que me pregunta es cual es la base de datos de TFS que voy a actualizar. Para comprobar que es la correcta pulso en el enlace de &lt;em&gt;List Available Databases&lt;/em&gt; y me tiene que salir, como poco, la de Tfs_configuration. Además, ya que estoy utilizando un snapshot como copia de seguridad, hago check en la casilla inferior en donde le digo que tengo un backup actual.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-byqPgiC4eGA/UNMN-0OafKI/AAAAAAAACjw/1x8hkT_XJAc/s1600-h/image%25255B14%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-MjNWIwexCWg/UNMOACH-t-I/AAAAAAAACj4/uQHg37zh2dc/image_thumb%25255B6%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;La siguiente pantalla trata de la cuenta de servicio que voy a utilizar para mi &lt;em&gt;Application-Tier&lt;/em&gt;, la cual (por si no te acuerdas) debería ser algo como &lt;em&gt;TFSSERVICE&lt;/em&gt;. No es buena práctica utilizar una cuenta de sistema.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-r2FBdaNFMJ0/UNMOBK7VddI/AAAAAAAACkA/qQg-ekhaK4M/s1600-h/image%25255B18%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-7JOKGqNlD2w/UNMOCcBbzMI/AAAAAAAACkI/cxsK9o0u_nY/image_thumb%25255B8%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Continuamos con la configuración del Reporting Server en donde le indico cual es el servidor que voy a utilizar y le doy al enlace de Populate URLs para que me añada el solito las URL adecuadas.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-Mev90Y2uzfU/UNMODWEPi8I/AAAAAAAACkQ/vk181uybNqw/s1600-h/image%25255B22%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-o170z3G2eoI/UNMOEjuu4EI/AAAAAAAACkU/XTSoJMHx0Jo/image_thumb%25255B10%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Ahora empezamos con chicha, le tengo que indicar cual es la base de datos que soporta el &lt;em&gt;Team Foundation Warehouse&lt;/em&gt;. Lo pruebo pinchando en el enlace de &lt;em&gt;Test&lt;/em&gt; y a continuación compruebo las bases de datos pinchando en el enlace &lt;em&gt;List Avaliable Databases.&lt;/em&gt; Al menos debe aparecer una.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-o56DIDpMBJk/UNMOFX1lxrI/AAAAAAAACkg/Zbbp5Y4h5aI/s1600-h/image%25255B26%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-G9occpU3K4U/UNMOG3wy2eI/AAAAAAAACko/GrRA8OHasFk/image_thumb%25255B12%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;p&gt;Continuamos indicando cual es la base de datos que soporta los Analisys Services, y comprobamos su correcto funcionamiento pinchado en &lt;em&gt;Test&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-ky4N9OMk-b4/UNMOHkMUE9I/AAAAAAAACks/SzL2pph1vuU/s1600-h/image%25255B30%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-ZDuD8vTkieU/UNMOIvJp-HI/AAAAAAAACk4/_1jz3tkTYg8/image_thumb%25255B14%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Continuamos por la configuración de la cuenta de servicio que va a ser utilizada para contactar con el servidor de Reportes, la cual no debiera ser de sistema y debería ser algo como TFSREPORT.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-nQOgg8u10cc/UNMOJg9aEII/AAAAAAAAClA/PwdvfiW9Vjo/s1600-h/image%25255B34%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-W0odsGMBj4o/UNMOLP04ZuI/AAAAAAAAClI/O5LRg2vFVRQ/image_thumb%25255B16%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Ahora configuremos el acceso a SharePoint para los portales de los proyectos, lo cual es muy sencillo: los dejo como estaba.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-2r8C2xv_mjU/UNMOL8_BncI/AAAAAAAAClQ/bRQg6x_zWdA/s1600-h/image%25255B41%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-z4YfbhkB3Fs/UNMONDDTJjI/AAAAAAAAClY/n8GdPMk12s4/image_thumb%25255B19%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Ahora nos vamos a la pantalla de Review y lanzamos la verificación de todos los datos que hemos introducido.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-lggnQUkCpUQ/UNMOOHZMpBI/AAAAAAAAClg/Ixgg1CRZEr0/s1600-h/image%25255B49%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-n3dd_xwnPKM/UNMOPQoDJDI/AAAAAAAAClo/2SFuiCPLT7s/image_thumb%25255B23%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Aquí me salto la alerta avisándome que no se podía actualizar la base de datos y, buscando en internet, encontré que era a causa de que no se puede actualizar directamente de TFS11 beta TFS2012 con Update 1. Hay que pasar primero por TFS2012 normal, que puedes encontrar aquí: &lt;a href="http://www.microsoft.com/visualstudio/esn/downloads" target="_blank"&gt;Team Foundation Server 2012 without Update 1&lt;/a&gt; en el enlace superior derecho, no en el listado de TFS a descargar.&lt;/p&gt; &lt;p&gt;Le doy a verificar y, si todo está correcto, deberían salir todos verdes.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-rHBYJbNN70w/UNMOQOuDNDI/AAAAAAAAClw/52Tw_jR0H94/s1600-h/image%25255B53%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-EyyCtGvFhzU/UNMORuWSgcI/AAAAAAAACl4/MZ-sqB34OKE/image_thumb%25255B25%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt;      &lt;p&gt;Le damos al botón Configure, y se pone a configurar el TFS2012 en la base de datos y a hacer sus cosas raras que hace por dentro. Es el momento de la verdad, si algo rompe aquí la cosa va a pintar bastos.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-Nya56wyWuhM/UNMOSiGO8tI/AAAAAAAACmA/fLlhCfUpHiQ/s1600-h/image%25255B61%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-Kdd4b1XW1-8/UNMOTvZnUyI/AAAAAAAACmI/92gJIP_QiI8/image_thumb%25255B29%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Y después de un rato de redoble de tambores… tachan!!! Lo que estaba esperando de agua de Mayo: la pantalla de Sucess. La alerta que me sale es que no se puede cambiar el grupo &lt;em&gt;Contributor&lt;/em&gt; de SharePoint, lo cual está bien.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-arexqbzM4zM/UNMOUn7T-_I/AAAAAAAACmQ/4WTbQIPDuAQ/s1600-h/image%25255B65%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-Y3r1Dc_ypuI/UNMOVy6ALPI/AAAAAAAACmY/9frC1QkHSNs/image_thumb%25255B31%25255D.png?imgmax=800" width="644" height="483"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Ahora a por el Update 1, pero eso será otro artículo (si merece la pena).&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/tH24RFvY1AM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/8099809036781340785/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=8099809036781340785" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/8099809036781340785?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/8099809036781340785?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/tH24RFvY1AM/migrando-de-tfs11beta-tfs2012-with.html" title="Migrando de TFS11Beta a TFS2012 with Update 1" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-Ib5RIvuWtpY/UNMN78WeRzI/AAAAAAAACjY/aH6WybQjw94/s72-c/image_thumb%25255B21%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/12/migrando-de-tfs11beta-tfs2012-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIARn4-fip7ImA9WhNWGE4.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-4465475772020491867</id><published>2012-12-18T12:35:00.001+01:00</published><updated>2012-12-18T12:35:47.056+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-18T12:35:47.056+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><title>Recargar un ListView navegando con un Back()</title><content type="html">&lt;p&gt;Primero un Disclamer: lo que estoy haciendo no es el modo correcto. Me he saltado, por causas justificadas, el uso de MVVM y lo he hecho al estilo “mero macho”: en code behind.&lt;/p&gt; &lt;p&gt;Tengo una página de listado de usuarios, cuando pulso en el botón más me voy a un formulario de alta de un nuevo usuario. Pero, como accedo a esa página desde varios sitios, utilizo GoBack() para volver a la página anterior en el historial de navegación.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-C0vafD9DU74/UNBU3itOWzI/AAAAAAAACiI/8iqTZCirmEQ/s1600-h/image%25255B2%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-U_SJd2R0Tt8/UNBU4ib0zMI/AAAAAAAACiQ/mjANlj0-oIo/image_thumb.png?imgmax=800" width="229" height="244"&gt;&lt;/a&gt;&lt;strong&gt;&lt;font size="1"&gt;&lt;br&gt;Listado inicial&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-0HNwbmLNQ9U/UNBU5ZVOTNI/AAAAAAAACiU/eoXKg5En2Ck/s1600-h/image%25255B5%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-xP9rtamGnCY/UNBU6aOgZwI/AAAAAAAACic/Y91MeGLriqM/image_thumb%25255B1%25255D.png?imgmax=800" width="244" height="65"&gt;&lt;/a&gt;&lt;br&gt;&lt;font size="1"&gt;&lt;strong&gt;Alta de un nuevo usuario&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;El problema viene cuando acabo de añadir un usuario y vuelvo a la página de la Lista de Usuarios, que no se me ha actualizado, ya que tira de caché.&lt;/p&gt;&lt;a href="http://lh6.ggpht.com/-zJQJpdiyBFk/UNBU7PmBwKI/AAAAAAAACio/ofur407ww1M/s1600-h/image%25255B8%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-L2AWsHS_Nfk/UNBU8WzQjOI/AAAAAAAACis/HStUe3hUDuM/image_thumb%25255B2%25255D.png?imgmax=800" width="229" height="244"&gt;&lt;/a&gt;&lt;strong&gt;&lt;font size="1"&gt;&lt;br&gt;Ups, no se actualiza&lt;/font&gt;&lt;/strong&gt; &lt;p&gt;Dándole vueltas he llegado a una solución imperfecta, pero que me vale. La asignación del datocontext de la página en vez de hacerlo en el constructor de la página, lo realizo en el evento de carga.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ListadoUsuarios &lt;/span&gt;&lt;span style="background: white; color: black"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Page&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;ListadoUsuarios()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loaded += ListadoUsuarios_Loaded;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;ListadoUsuarios_Loaded(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sender,&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black"&gt;e)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;VMLocator &lt;/span&gt;&lt;span style="background: white; color: black"&gt;locator =&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;VMLocator&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.DataContext = locator.ListadoUsuariosViewModel;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;De esta forma me aseguro, llegue como llegue a esta página, que se me recargue el Listado de Usuarios.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-H_FrovMNQB4/UNBU9Pr9cNI/AAAAAAAACi4/v4o4Z8FI1VA/s1600-h/image%25255B11%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-1BsuV2qUisc/UNBU-iwD2kI/AAAAAAAACi8/g9omPLS5Xek/image_thumb%25255B3%25255D.png?imgmax=800" width="229" height="244"&gt;&lt;/a&gt;&lt;br&gt;&lt;strong&gt;&lt;font size="1"&gt;Ahora si que se actualiza siempre.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;P.D. Olvídate de la clase VMLocator, lo importante es cómo creas el ViewModel y la propiedad pública que utilices para el DataContext de la página.&lt;/span&gt;&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/BOrTmmXbi8Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/4465475772020491867/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=4465475772020491867" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4465475772020491867?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4465475772020491867?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/BOrTmmXbi8Y/recargar-un-listview-navegando-con-un.html" title="Recargar un ListView navegando con un Back()" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-U_SJd2R0Tt8/UNBU4ib0zMI/AAAAAAAACiQ/mjANlj0-oIo/s72-c/image_thumb.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/12/recargar-un-listview-navegando-con-un.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIMRXw8eCp7ImA9WhNWEUg.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7942814692036077313</id><published>2012-12-10T17:39:00.001+01:00</published><updated>2012-12-10T17:39:44.270+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-10T17:39:44.270+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><title>WPF. Al declarar el DataContext a un control da error de referencia nula</title><content type="html">&lt;p&gt;Este es uno de esos errores “tontos” que provocan que pierdas un montón de tiempo mientras estás aprendiendo a trabajar con WPF.&lt;/p&gt; &lt;p&gt;Tengo la siguiente declaración que, cuando llega a cargar el datacontext del control ListView, me da un error de referencia de objeto nula.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;DetalleCliente(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Clientes &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DetalleClienteViewModel &lt;/span&gt;&lt;span style="background: white; color: black"&gt;viewModel = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DetalleClienteViewModel&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(cliente);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.DataContext = viewModel.Cliente;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListView.ItemsSource = viewModel.Suscripciones;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;br&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;¿Has encontrado ya el problema?&lt;/p&gt; &lt;p&gt;Es facil cuando te alejas y empiezas a depurar en la mente:&lt;/p&gt; &lt;p&gt;1. Instancio la clase viewmodel.&lt;br&gt;2. A this, le digo que su datacontext es la propiedad Cliente de viewmodel.&lt;br&gt;3. A ListView le digo que el source de los item es la propiedad Suscripciones del viewmodel… de aquí no pasa!!&lt;/p&gt; &lt;p&gt;Espera, ListView es un control, y los controles se inicializan con la orden InitializeComponent(). Por lo cual estoy intentando asignar el datasource a un control que aún no ha sido instanciado, por lo cual me devuelve un error de objeto nulo.&lt;/p&gt; &lt;p&gt;Cambiando para que inicialice la página y sus controles se arregla todo.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;DetalleCliente(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Clientes &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente)&lt;br&gt;{&lt;br&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DetalleClienteViewModel &lt;/span&gt;&lt;span style="background: white; color: black"&gt;viewModel = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DetalleClienteViewModel&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(cliente);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.DataContext = viewModel.Cliente;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListView.ItemsSource = viewModel.Suscripciones;&lt;br&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;Espero que sirva de ayuda.&lt;/span&gt;&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/OT080fO8sGw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7942814692036077313/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7942814692036077313" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7942814692036077313?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7942814692036077313?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/OT080fO8sGw/wpf-al-declarar-el-datacontext-un.html" title="WPF. Al declarar el DataContext a un control da error de referencia nula" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/12/wpf-al-declarar-el-datacontext-un.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkABSH08fyp7ImA9WhNXEE4.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7363826405591171677</id><published>2012-11-27T18:52:00.001+01:00</published><updated>2012-11-27T18:52:39.377+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-27T18:52:39.377+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><title>Navegar desde una Page que está dentro de un Frame</title><content type="html">&lt;p&gt;Haciendo la aplicación WPF, y saltándome la arquitectura MVVM hasta que le coja el tranquillo a cosas aún más básicas como esta, me he encontrado con ciertas dificultades para poder pasar de una página a otra.&lt;/p&gt; &lt;p&gt;Esto es debido a que la aplicación corre en una Windows con un Frame en su interior y dentro de este invoco a las Page oportunas. Así la window tiene una declaración tal que así:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Window &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="TSA_KMSPanel.MainWindow"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="KMSPanel" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Frame &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="FrameCuerpo" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Source&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="ListadoClientes.xaml" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;NavigationUIVisibility&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Hidden"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Frame&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Window&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;La página que abre por defecto es Listadoclientes.xaml que tiene un botón que es el que le hace ir a la siguiente página. Y que su xaml es algo así:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Page &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="TSA_KMSPanel.ListadoClientesView"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.openxmlformats.org/markup-compatibility/2006" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="http://schemas.microsoft.com/expression/blend/2008" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Title&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="ListadoClientes"&amp;gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="bRecarga" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Content&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Cursor&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Hand"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Click&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="bRecarga_Click" /&amp;gt;&lt;br&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Page&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Como has visto las dos únicas cosas que he añadido es que el cursor sea una dedito cuando se pone por encima, y el evento que se lanza cuando el click. Y ahora vamos al truco del almendruco en el code behind.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;private void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;bRecarga_Click(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sender,&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black"&gt;e)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.NavigationService.Navigate(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;"PantallaClientes.xaml"&lt;/span&gt;&lt;span style="background: white; color: black"&gt;,&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;UriKind&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Relative));&lt;br&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Y ¿cómo consigo que no salga la barra espantosa de navegación?, pues fíjate en la declaración del frame que va a contener todas las páginas de la aplicación le he dicho:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: red"&gt;NavigationUIVisibility&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Hidden"&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Y con esto tengo la enorme ventaja de que el NavigationService me permite cosas tan chulas como historial de navegación, etc.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/91TV3PStx5g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7363826405591171677/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7363826405591171677" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7363826405591171677?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7363826405591171677?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/91TV3PStx5g/navegar-desde-una-page-que-esta-dentro.html" title="Navegar desde una Page que está dentro de un Frame" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/11/navegar-desde-una-page-que-esta-dentro.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAHRX4yfCp7ImA9WhNQGUk.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-9008981471227826083</id><published>2012-11-26T17:52:00.001+01:00</published><updated>2012-11-26T17:52:14.094+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-26T17:52:14.094+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVVM" /><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><title>Cuando ICommand decide no aparecer</title><content type="html">&lt;p&gt;Siguiendo con el proyecto en WPF me he encontrado con un retorcido funcionamiento del Visual que me ha dejado perplejo un buen rato.&lt;/p&gt; &lt;p&gt;El proyecto de WPF está dividido en tres capas diferentes: View, ViewModel y Entidades.&lt;/p&gt; &lt;p&gt;Pues bien, me pongo ha implementar el DelegateCommand y despues de darle a los dos puntos no me reconoce el interface ICommand&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DelegateCommand &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ICommand&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Me voy a buscar en MSDN y veo que su espacio de nombres es:&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Windows.Input;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Pero nada sigue sin aparecerme ni reconocerlo. Asique me pongo a buscar las diferencias en las referencias de ambos proyectos: uno WPF y el otro de clases, y después de varias pruebas y errores he encontrado cual es la referencia que hay que añadir:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;PresentationCore&lt;/strong&gt;&lt;/p&gt;Y ala, todo a funcionar corréctamente.  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/RXpSNFL7Ljs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/9008981471227826083/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=9008981471227826083" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/9008981471227826083?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/9008981471227826083?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/RXpSNFL7Ljs/cuando-icommand-decide-no-aparecer.html" title="Cuando ICommand decide no aparecer" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/11/cuando-icommand-decide-no-aparecer.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cGSXwycSp7ImA9WhNQGU4.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-3224332720982713076</id><published>2012-11-26T12:47:00.001+01:00</published><updated>2012-11-26T12:57:08.299+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-26T12:57:08.299+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVVM" /><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><title>Como rellenar un GridView en WPF siguiendo MVVM - II</title><content type="html">&lt;p&gt;En el &lt;a href="http://1poquitodtodo.blogspot.com.es/2012/11/como-rellenar-un-gridview-en-wpf.html"&gt;artículo anterior&lt;/a&gt; describí a grosso modo todo lo que necesitaba para poder rellenar un GridView en WPF, desde la base de datos, siguiendo el patrón MVVM. Bueno, realmente aún me falta implementar el locator para quitar del todo el código en el codebehind del xaml.cs.&lt;/p&gt; &lt;p&gt;Pero ahora me voy a centrar en la Vista y cómo obtener un GridView (como los de ASP.NET) o “Grilla” (como dicen los compañeros latinoamericanos) con contenido.&lt;/p&gt; &lt;p&gt;Para ello primero utilizo un ListView, dentro del cual defino una vista, y dentro de esta vista un GridView.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="ViewClientes"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Idcliente"&lt;/span&gt;&lt;span style="background: white; color: blue"&gt; /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Nombre" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;/&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Apellidos" &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;/&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Si lanzamos nuestro código obtendremos un GridView vacio, pero con los encabezados. Para recuperar los datos lo primero es decirle al ListView que debe de mostrar, teniendo en cuenta que ya enlazamos en el artículo anterior el Datacontext de la Vista.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="ViewClientes"&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="50,50,50,0"&lt;/span&gt;&lt;span style="background: white; color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListadoClientes&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}"&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Fíjate que le estoy diciendo que utilice la propiedad pública ListadoClientes de la clase del ViewModel PantallaClientes. Y como esta propiedad es un List&amp;lt;Cliente&amp;gt; pues ya puedo definir en las columnas del GridView que campo quiero que muestre.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: #a31515"&gt;&amp;lt;ListView &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="ViewClientes" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListadoClientes&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}"&amp;gt;&lt;br&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Idcliente" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;DisplayMemberBinding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;IdCliente&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Nombre" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;DisplayMemberBinding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Nombre&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridViewColumn &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Header&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="Apellidos" &lt;/span&gt;&lt;span style="background: white; color: red"&gt;DisplayMemberBinding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;="{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Apellidos&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}" /&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ListView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;div class="csharpcode"&gt;&amp;nbsp;&lt;/div&gt; &lt;div class="csharpcode"&gt;&amp;nbsp;&lt;/div&gt; &lt;p&gt;Y con esto ya está funcionando!!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/ucJ9B6UfNT8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/3224332720982713076/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=3224332720982713076" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3224332720982713076?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3224332720982713076?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/ucJ9B6UfNT8/como-rellenar-un-gridview-en-wpf_26.html" title="Como rellenar un GridView en WPF siguiendo MVVM - II" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/11/como-rellenar-un-gridview-en-wpf_26.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0UGR388eSp7ImA9WhNQGU4.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7649569775575816364</id><published>2012-11-26T12:14:00.001+01:00</published><updated>2012-11-26T13:00:26.171+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-26T13:00:26.171+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVVM" /><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><title>Como rellenar un GridView en WPF siguiendo MVVM</title><content type="html">&lt;p&gt;Estoy aprendiendo WPF siguiendo el libro de Introducción a programación en Windows 8 y Windows Phone 8 de Josué Yeray, Rafael Serna&amp;nbsp; e Ibón Landa.&lt;/p&gt; &lt;p&gt;Así, cuando me he enfrentado con representar una lista de datos en pantalla, he encontrado rápidamente la utilidad de la Vista GridView de las List View.&lt;/p&gt; &lt;p&gt;Así, tengo una entidad de Cliente, que entre otros campos tiene un IdCliente, un Nombre y un Apellidos.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public int &lt;/span&gt;&lt;span style="background: white; color: black"&gt;IdCliente {&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Nombre {&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Apellidos {&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;  &lt;p&gt;En la capa de Datos he creado una capa que realiza la recuperación de la colección de clientes que está persistida en la base de datos, a través del EF.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ClientesDAL&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &amp;lt;summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;/span&gt;&lt;span style="background: white; color: green"&gt;Devuelve el listado total de clientes&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &amp;lt;/summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; GetClientesList()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;KMSPanelModelContainer &lt;/span&gt;&lt;span style="background: white; color: black"&gt;contexto = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;KMSPanelModelContainer&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;from &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;contexto.Clientes&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;select &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente).ToList();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente &lt;/span&gt;&lt;span style="background: white; color: black"&gt;GetClienteById(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente &lt;/span&gt;&lt;span style="background: white; color: black"&gt;pCliente)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;KMSPanelModelContainer &lt;/span&gt;&lt;span style="background: white; color: black"&gt;contexto = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;KMSPanelModelContainer&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;from &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;contexto.Clientes&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;where &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente.IdCliente == pCliente.IdCliente&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;select &lt;/span&gt;&lt;span style="background: white; color: black"&gt;cliente).FirstOrDefault();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;p&gt; &lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt; &lt;/p&gt; &lt;p&gt;En el ViewModel, tengo mi clase que va a ser el DataContext y en donde cargo un listado de clientes en la propiedad pública.&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PantallaClientes &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;VMBase&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; listadoClientes;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; ListadoClientes&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;GetClientesList(); }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{ listadoClientes = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;value&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PantallaClientes()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listadoClientes = GetClientesList();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &amp;lt;summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;/span&gt;&lt;span style="background: white; color: green"&gt;Devuelve el listado de clientes&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &amp;lt;/summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Cliente&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; GetClientesList()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ClientesDAL &lt;/span&gt;&lt;span style="background: white; color: black"&gt;clientesDAL = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ClientesDAL&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;clientesDAL.GetClientesList();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;p&gt; &lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt; &lt;/p&gt; &lt;p&gt;Ahora (perdonarme el código en el codebehind, pero aún no lo he terminado del todo) enlazo el DataContext de la Vista (View).&lt;/p&gt; &lt;p&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;MainWindow &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Window&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MainWindow()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.DataContext = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: black"&gt;TSA_KMSPanel.ViewModel.&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PantallaClientes&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;p&gt; &lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt; &lt;/p&gt; &lt;p&gt;Y ahora llegamos al binding en el XAML, pero el cual lo voy a poner en &lt;a href="http://1poquitodtodo.blogspot.com.es/2012/11/como-rellenar-un-gridview-en-wpf_26.html"&gt;el siguiente post&lt;/a&gt;.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/K8LOWcicJm8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7649569775575816364/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7649569775575816364" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7649569775575816364?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7649569775575816364?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/K8LOWcicJm8/como-rellenar-un-gridview-en-wpf.html" title="Como rellenar un GridView en WPF siguiendo MVVM" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/11/como-rellenar-un-gridview-en-wpf.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUHRHY6eCp7ImA9WhNQGU8.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-3695692095446615893</id><published>2012-11-26T11:53:00.001+01:00</published><updated>2012-11-26T11:53:55.810+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-26T11:53:55.810+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework" /><title>Donde debe estar la cadena de conexión de las Entidades (EF)</title><content type="html">&lt;p&gt;Con este post voy a iniciar una serie de artículos sobre una aplicación WPF que estoy realizando y que me está entusiasmando.&lt;/p&gt; &lt;p&gt;El primer problema, y que he vivido en otras ocasiones es que siempre utilizo una arquitectura de capas y esta vez no iba a ser diferente. Así el proyecto sigue la arquitectura del patrón MVVM, y está compuesto por cuatro proyectos:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;La Vista&lt;/li&gt; &lt;li&gt;El ViewModel&lt;/li&gt; &lt;li&gt;Las Entidades (Entity Framework)&lt;/li&gt; &lt;li&gt;Los Test&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;El problema venía que cuando lanzaba el proyecto para recuperar un listado de la base de datos a través del proyecto de Entidades que se encarga del accedo a datos, el proyecto ViewModel me decía que no encontraba la cadena de conexión.&lt;/p&gt; &lt;p&gt;La solución es simple cuando ya la conoces: crea un nuevo fichero App.config en el proyecto de la Vista e introduce en el la cadena de conexión. Así la tendrás disponible para todos los proyectos ya que el punto de entrada, y donde va a buscar esa configuración.&lt;/p&gt; &lt;p&gt;Espero que sea de utilidad.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/ivaf3SwIa30" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/3695692095446615893/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=3695692095446615893" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3695692095446615893?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3695692095446615893?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/ivaf3SwIa30/donde-debe-estar-la-cadena-de-conexion.html" title="Donde debe estar la cadena de conexión de las Entidades (EF)" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/11/donde-debe-estar-la-cadena-de-conexion.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4BRH07cCp7ImA9WhNQF00.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-4477188304427928783</id><published>2012-11-23T22:59:00.000+01:00</published><updated>2012-11-23T22:59:15.308+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-23T22:59:15.308+01:00</app:edited><title>Community Day 2012, el sabor agridulce de un gran evento</title><content type="html">Primero&lt;b&gt; quiero dar las gracias a MS, y a Bonin&lt;/b&gt;
(&lt;i&gt;especialmente&lt;/i&gt;) por invitarme por segunda vez a este evento de los MVP de
España; es todo un honor y un privilegio el poder estar rodeado de, posiblemente,
el grupo más selecto de profesionales en tecnologías de Microsoft.&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
El año pasado el evento estuvo muy centrado en sesiones
técnicas, y parece que hubo suficientes comentarios como para que la
organización de la convocatoria de 2012 empujara el péndulo al otro lado.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Así nos encontramos con un evento en grupos de 5 personas
que nos llevó a caminar por el centro de Madrid en la búsqueda de fotos y datos
singulares de la capital, y que fue muy divertido&amp;nbsp; a pesar del obvio bajo estado físico de quien
escribe estas líneas.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Acabada la &lt;i&gt;Ginkana&lt;/i&gt;, repartieron los premios entre aplausos,
bromas, chanzas y una lluvia de comida. Me monté en mi caballo de hierro y me fui,
cansado y con dolor de espalda, a mi casa con una sensación agridulce.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Si bien el día anterior en&lt;b&gt; el TechDay, desde mi punto de
vista, el evento fue todo un éxito&lt;/b&gt; y me lo pasé en grande hablando con mucha
gente muy interesante y disfruté de charlas técnicas aprendiendo de todas
ellas; en cambio en el Community Day el formato de competición en grupos
solitarios, me toco un grupo buenísimo, impidió seguir haciendo networking y, además,
no hubo la reunión que tanto llevo pidiendo para organizarnos un poquito los Technical
Rangers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Es más, no hubo ninguna reunión, ni charla, ni &lt;b&gt;nada más que
3 horas de caminar por Madrid&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Somos profesionales, somos conocidos, pero muy pocos somos
tan amigos como para pedir días de vacaciones, o dedicar un Viernes en hacer
una actividad de este estilo. Es más, y espero no levantar ningún revuelo, hay
algo raro en el ambiente de los MVP, unas relaciones amor-odio-competencia &amp;nbsp;ocultas tras sonrisas y buenas palabras, que
me ha dejado más bien perplejo y con la sensación de ser un tanto pardillo al
creer que “&lt;i&gt;to er mundo es bueno&lt;/i&gt;”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
El día anterior, ponentes en el TechDay me comentaban que &lt;b&gt;no
se pueden hacer charlas técnicas potentes y profundas &amp;nbsp;porque el gran público no las puede seguir&lt;/b&gt;. Por
ello esperé &amp;nbsp;para el día siguiente alguna
charla avanzada para un público mucho más profesional y con conocimiento. Un ponente
potente, tal vez, o mesas redondas en donde los mejores profesionales le puedan
decir de viva voz a MS qué necesitan para mejorar o para hacer mejor su&amp;nbsp; labor de difusión.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
En resumen, utilizar el tiempo en hacer algo útil. Algo que
supere el subir fotos a Twiter y que nos deje un buen sabor de boca, como
profesionales, de que hemos estado en un evento especial, orgullosos de haber
sido merecedores de ser invitados.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Desde el punto de vista de Technical Ranger, ha sido un
fiasco. El año pasado en Fuengirola sacamos en claro, en la reunión que hicimos,
que había sido un éxito el programa. Y que teníamos que organizarnos un poco
para conseguir aún mejores resultados. Pero este año no solamente&lt;i&gt; el programa
languidece&lt;/i&gt;, si no que se ha perdido la oportunidad de tenernos a todos juntos
para poder encontrar donde estamos y a dónde queremos ir.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Y creo, pero es solo mi opinión, que el problema es que&lt;b&gt; no
ha habido objetivo claro de para qué nos reunimos en este Community&lt;/b&gt;. Da la
sensación, pero es solo una sensación y por ello posiblemente injusta, de que
se ha volcado la organización tanto en el TechDay, que ha llegado desfondada al Community y lo ha despachado contratando una empresa de eventos
empresariales.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
De todas formas, y a pesar de este sabor agridulce, me quedo
con las conversaciones con tantos MVP, MSP, gente de MS y todos los
profesionales a los que tanto respeto y a los que, en cada evento, les voy
cogiendo un aprecio personal. Y&lt;b&gt; estoy impaciente por que llegue el Community
del 2013 y volver a merecerme ser invitado&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Muchas gracias.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/TGFmgffQmp8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/4477188304427928783/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=4477188304427928783" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4477188304427928783?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4477188304427928783?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/TGFmgffQmp8/community-day-2012-el-sabor-agridulce.html" title="Community Day 2012, el sabor agridulce de un gran evento" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/11/community-day-2012-el-sabor-agridulce.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08GQHo-cCp7ImA9WhJVFko.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7954612504208040488</id><published>2012-09-03T13:30:00.001+02:00</published><updated>2012-09-03T13:30:21.458+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-03T13:30:21.458+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VS2012" /><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2010" /><title>Configurando un SharePoint 2010 en Windows 2012 Server</title><content type="html">&lt;p&gt;En el artículo anterior sobre Instalar un &lt;a href="http://1poquitodtodo.blogspot.com.es/2012/09/instalar-un-sharepoint-2010-en-un.html"&gt;SharePoint 2010 en un Windows 2012 Server&lt;/a&gt; había resuelto las incidencias para conseguir instalar correctamente la aplicación.&lt;/p&gt; &lt;p&gt;Pero cuando lanzo el configurador, después de haber instalado los añadido de Sharepoint del Visual Studio 2012 y de la SQL 2012 Server, me da problemas.&lt;/p&gt; &lt;p&gt;La solución, como siempre, son varias actuaciones.&lt;/p&gt; &lt;p&gt;* Entrar en el IIS y poner todos los Pool de aplicaciones relacionadas con SharePoint a la versión 2.x de .NET, ya que no funciona en 4.0.&lt;/p&gt; &lt;p&gt;* Visitar este blog: &lt;a href="http://sharepoint.nauplius.net/2012/06/installing-sharepoint-2010-and-sql.html"&gt;http://sharepoint.nauplius.net/2012/06/installing-sharepoint-2010-and-sql.html&lt;/a&gt; en donde nos enseña como modificar el PowerShell de SharePoint para que use la versión 2.0 y no la 3.0 que es la que viene con el WS2012 y con la que no funciona bien.&lt;/p&gt; &lt;p&gt;* Correr este PowerShell con privilegios de administración: &lt;/p&gt;&lt;pre&gt;&lt;font size="1"&gt;Set-WebConfigurationProperty “/system.applicationHost/applicationPools/applicationPoolDefaults” –Name managedRuntimeVersion –Value “v2.0” –PSPath IIS:\&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Trebuchet MS"&gt;Que lo que hace es decirle al IIS que por defecto haga el default app correr en versión 2.0 del Framework.&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Trebuchet MS"&gt;Y lanzando de nuevo el configurador de SharePoint, todo finalizó correctamente.&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Trebuchet MS"&gt;Espero que sea de utilidad&lt;/font&gt;&lt;/pre&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/SJEwyWSSmrQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7954612504208040488/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7954612504208040488" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7954612504208040488?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7954612504208040488?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/SJEwyWSSmrQ/configurando-un-sharepoint-2010-en.html" title="Configurando un SharePoint 2010 en Windows 2012 Server" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/09/configurando-un-sharepoint-2010-en.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0AGQHs7fyp7ImA9WhJVFks.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-3138955694004075367</id><published>2012-09-03T10:42:00.001+02:00</published><updated>2012-09-03T10:42:01.507+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-03T10:42:01.507+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows 2012 Server" /><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2010" /><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint" /><title>Instalar un SharePoint 2010 en un Windows 2012 Server</title><content type="html">&lt;p&gt;Como todo en IT, no hay nada fácil y sencillo. Y la instalación de un SharePoint 2010 para desarrollo en un novísimo Windows 2012 server no iba a ser diferente.&lt;/p&gt; &lt;p&gt;Básicamente los pasos que realice fueron (todo en inglés):&lt;/p&gt; &lt;p&gt;* Instalar el Windows 2012 Server&lt;/p&gt; &lt;p&gt;* Instalar el SQL Server 2012 con todo menos las extensiones de SharePoint y el PowerPivot.^&lt;/p&gt; &lt;p&gt;* Lanzar el instalador de SharePoint 2012, para que me pidiera los prerequisitos, que fui descargando e instalando.&lt;/p&gt; &lt;p&gt;* Modificar los Roles del Servidor, como indica en el primer blog.&lt;/p&gt; &lt;p&gt;* Insertar en Windows/System32 el fichero ServerManagerCmd.exe que me bajé de la segunda dirección y que no hace nada más que devolver un código.&lt;/p&gt; &lt;p&gt;El sitio en donde mejor se describe la forma de instalar los prerequisitos &lt;/p&gt; &lt;p&gt;&lt;a href="http://bifase.blogspot.com.es/2012/03/windows-8-server-y-sharepoint-2010.html"&gt;http://bifase.blogspot.com.es/2012/03/windows-8-server-y-sharepoint-2010.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;y&amp;nbsp; aquí el fichero de Steve, que refiere en el blog anterior. OJO un fichero ServerManagerCmd que es el que me volvió loco y que , hasta que no lo puse en System32 finálmente, no funcionaba el instalador de SP2010. &lt;/p&gt; &lt;p&gt;&lt;a href="http://blog.hand-net.com/sharepoint/2010-06-10-error-lors-de-linstallation-des-office-web-apps-2010-sur-windows-7.htm"&gt;http://blog.hand-net.com/sharepoint/2010-06-10-error-lors-de-linstallation-des-office-web-apps-2010-sur-windows-7.htm&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Este es el sitio de Microsoft en donde se pueden descargar todos los pre requisitos uno a uno.&lt;/p&gt; &lt;p&gt;&lt;a title="http://technet.microsoft.com/library/cc262485(office.14).aspx#section4" href="http://technet.microsoft.com/library/cc262485(office.14).aspx#section4"&gt;http://technet.microsoft.com/library/cc262485(office.14).aspx#section4&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Ale, número de serie de SharePoint 2012 y empezar la instalación Stand Alone para desarrollo.&lt;/p&gt; &lt;p&gt;Espero que sea útil para alguien más, a mi me ha costado una mañana.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/T09OChTaIXE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/3138955694004075367/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=3138955694004075367" title="2 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3138955694004075367?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/3138955694004075367?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/T09OChTaIXE/instalar-un-sharepoint-2010-en-un.html" title="Instalar un SharePoint 2010 en un Windows 2012 Server" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/09/instalar-un-sharepoint-2010-en-un.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YMR3o-fSp7ImA9WhJVEk4.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7304488113861594814</id><published>2012-08-28T15:07:00.001+02:00</published><updated>2012-08-29T12:13:06.455+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-29T12:13:06.455+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VSTO" /><category scheme="http://www.blogger.com/atom/ns#" term="VS2012" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio" /><title>Reference in the manifest does not match, o la guerra de los manifiestos</title><content type="html">&lt;p&gt;En los últimos coletazos de un EXCELENTE AddIn para Excel que hemos desarrollado en mi empresa (TeamPRO), nos hemos puesto a hacer las pruebas de la última versión del código ya con el código publicado y listo para realizar instalaciones.&lt;/p&gt; &lt;p&gt;Y nos ha salido esto:&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-DUitaqdnE9k/UDzDFCcPU9I/AAAAAAAAChc/OwdBPNNjqNg/s1600-h/image%25255B26%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-SFpsXTJ_0dc/UDzDGAzFsWI/AAAAAAAAChk/azeLFGmu0YI/image_thumb%25255B12%25255D.png?imgmax=800" width="488" height="484"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;La madre del cordero!!&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Después de googlear como locos empezamos a entender lo que ha ocurrido. Para realizar el pintado de los mapas hemos utilizado un proyecto open source (y gratis) llamado CustomColorPicker, el cual hemos añadido a la solución y que compilábamos y hacíamos referencia desde el proyecto en sí del AddIn.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-N2JRM6WCZq0/UDzCm-cJFDI/AAAAAAAACgs/nsBNEyyb304/s1600-h/image%25255B11%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-LbiL3cYuqcU/UDzCnsWtgCI/AAAAAAAACg0/D6kz7g792LI/image_thumb%25255B5%25255D.png?imgmax=800" width="164" height="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Cual es el problema, que el proyecto CustomColorPicker es un proyecto WPF de Windows, y lo que se referencia es un exe. Bueno realmente un exe.deploy. Y este ejecutable tiene un manifiesto que se pega con el manifiesto del AddIn.&lt;/p&gt; &lt;p&gt;¿Cual es la solución? Simple como la vida misma: quítale el manifiesto a CustomColorPicker, o en tu caso a la aplicación que es referenciada por la principal.&lt;/p&gt; &lt;p&gt;¿Cómo se hace eso? Pues mira las pantallitas y te quedará claro.&lt;/p&gt; &lt;p&gt;Primero saca el menú contextual del proyecto al que le quieres quitar el manifiesto con el botón derecho.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-VGZ_qWtygOc/UDzCoIVA-AI/AAAAAAAACg8/SuzR1awDeKw/s1600-h/image%25255B18%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-8I2LFLFmyeE/UDzCpJB0SVI/AAAAAAAAChE/JpJ5lQG5m8g/image_thumb%25255B8%25255D.png?imgmax=800" width="327" height="484"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Así se abrirá la configuración de la aplicación en donde encontramos la configuración que hay que cambiar y que señalo con una flecha y que es “Crear la aplicación sin manifiesto”.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-9o4a7VFaRUc/UDzCpmA4BWI/AAAAAAAAChM/35wtDwWt0gQ/s1600-h/image%25255B22%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-xJJMFs5ynQc/UDzCqvYJ0fI/AAAAAAAAChU/2DmfFHphQIE/image_thumb%25255B10%25255D.png?imgmax=800" width="644" height="439"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Y con esto, compila, publica e instala. Que el mensaje de error por los manifiestos deja de producirse.&lt;/p&gt; &lt;p&gt;Espero que sea de utilidad.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/pgnmvgZABaQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7304488113861594814/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7304488113861594814" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7304488113861594814?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7304488113861594814?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/pgnmvgZABaQ/reference-in-manifest-does-not-match-o.html" title="Reference in the manifest does not match, o la guerra de los manifiestos" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-SFpsXTJ_0dc/UDzDGAzFsWI/AAAAAAAAChk/azeLFGmu0YI/s72-c/image_thumb%25255B12%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/08/reference-in-manifest-does-not-match-o.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QDRX4yfyp7ImA9WhJWF0Q.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-7345802986195246984</id><published>2012-08-24T10:02:00.001+02:00</published><updated>2012-08-24T10:02:54.097+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-24T10:02:54.097+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VSTO" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><category scheme="http://www.blogger.com/atom/ns#" term="WPD" /><title>Mover un Canvas dentro de un Canvas en WPF</title><content type="html">&lt;p&gt;Una de las cosas que más agobian es las pequeñas diferencias que hay en los lenguajes de programación de .NET. Y agobian porque las cosas más sencillas no están prácticamente en ningún sitio porque todo el mundo lo da por más que sabido.&lt;/p&gt; &lt;p&gt;Y es una de las razones principales de este blog. Compartir conocimientos de nivel 100 (iniciación).&lt;/p&gt; &lt;p&gt;Así me encuentro, en el proyecto este del Addin para Excel, que tengo la pantalla compuesta por diferentes capas en donde tengo, construidas sobre controles Canvas, los polígonos, los nombres y los diferentes valores.&lt;/p&gt; &lt;p&gt;Algo así, para que se entienda mejor:&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;Canvas x:Name=&lt;span style="color: #006080"&gt;"Canvas"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     &amp;lt;Path Name=&lt;span style="color: #006080"&gt;"a114"&lt;/span&gt; Fill=&lt;span style="color: #006080"&gt;"#FFC2C2D8"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &amp;lt;Path Name=&lt;span style="color: #006080"&gt;"a118"&lt;/span&gt; Fill=&lt;span style="color: #006080"&gt;"#FFC2C2D8 /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &amp;lt;Canvas Name="&lt;/span&gt;Valores&lt;span style="color: #006080"&gt;"&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &amp;lt;TextBlock Canvas.Left="&lt;/span&gt;683&lt;span style="color: #006080"&gt;" Canvas.Top="&lt;/span&gt;303&lt;span style="color: #006080"&gt;" Height="&lt;/span&gt;37&lt;span style="color: #006080"&gt;" Name="&lt;/span&gt;t112&lt;span style="color: #006080"&gt;" /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &amp;lt;/Canvas&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &amp;lt;Canvas Name="&lt;/span&gt;Nombres&lt;span style="color: #006080"&gt;"&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &amp;lt;TextBlock Canvas.Left="&lt;/span&gt;683&lt;span style="color: #006080"&gt;" Canvas.Top="&lt;/span&gt;303&lt;span style="color: #006080"&gt;" Height="&lt;/span&gt;37&lt;span style="color: #006080"&gt;" Name="&lt;/span&gt;t112" /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &amp;lt;/Canvas&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; &amp;lt;/Canvas&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Tengo un control “Canvas” general sobre el que pinto los polígonos del tipo Path, y añado dos capas más “Valores” y “Nombres” sobre las que pinto textos dentro de controles TextBlock. Viéndose algo tanto que así:&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-fkz0XpTgVoc/UDc1Jh69E1I/AAAAAAAACgE/jQEF0AV7edQ/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-MKWQCt_Ra9I/UDc1K7YrmYI/AAAAAAAACgM/Sk8HQe9VOi0/image_thumb%25255B1%25255D.png?imgmax=800" width="644" height="474"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Se podría hacer dos mil preguntas de porqué se tomo la decisión técnica de hacer las cosas así, pero eso lo cubriré con un tupido velo.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;El problema que quiero solucionar, es que puedo ocultar las cifras del valor que aparecen debajo del nombre y que entonces necesito que el nombre descienda unos 25 pixeles para que quede más centrado verticalmente, ocupando el sitio que ocupa el valor.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Después de darle mil vueltas, y gracias a @pablonete, encontré la forma de hacerlo y que es la mar de sencillo con un método del control del tipo Canvas.&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; Canvas.SetTop(canvasNombres, 0);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Es decir, Al tipo Canvas le invoco el método SetTop que lo que hace es mover el control tipo Canvas “canvasNombres”&amp;nbsp; 25 pixeles hacia abajo desde su Canvas contenedor. Que ya se encarga el solito de buscarlo.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;El quid del asunto aquí es cómo recuperar el Canvas “canvasNombre”. Y que, para darte una pista, es un Child del Canvas principal “Canvas”.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Espero que sea de utilidad.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/I6YcAH7Pqkw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/7345802986195246984/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=7345802986195246984" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7345802986195246984?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/7345802986195246984?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/I6YcAH7Pqkw/mover-un-canvas-dentro-de-un-canvas-en.html" title="Mover un Canvas dentro de un Canvas en WPF" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-MKWQCt_Ra9I/UDc1K7YrmYI/AAAAAAAACgM/Sk8HQe9VOi0/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/08/mover-un-canvas-dentro-de-un-canvas-en.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcEQH88eCp7ImA9WhJWFk4.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-140002054801567645</id><published>2012-08-22T14:09:00.001+02:00</published><updated>2012-08-22T14:20:01.170+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-22T14:20:01.170+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VSTO" /><category scheme="http://www.blogger.com/atom/ns#" term="GDI+" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><title>Pintando un gráfico de tartas en un ImageBitMap</title><content type="html">&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;La verdad que esto del desarrollo sigue siendo muy interesante, aún en mi actual faceta de responsable de departamento y, por ende, con labores más de gestión que de picar código.&lt;/p&gt; &lt;p&gt;Le estoy echando una mano a un equipo que está desarrollando un Addin para Excel, y así pruebo qué tal va el VS2012 RTM, que ha mejorado bastante al ya de por sí bueno VS2012 RC.&lt;/p&gt; &lt;p&gt;Me encuentro que el programador anterior (que el demonio lo tenga en la más miserable celda posible en el infierno) debía tener conocimientos más bien cortitos y, para pintar un indicador que mostrara el porcentaje de un valor, no se le ocurrió otra cosa que hacer un bitmap por cada 10 grados de una imagen de una gráfica de tarta y, con cientos de líneas de código, montar un “chocho” impresionante para saber cual utilizar según el porcentaje.&lt;/p&gt; &lt;p&gt;En cuanto lo vi, me di cuenta que con un poquito de GDI+ lo tenia solucionado. Y así fue, casi mil líneas de código convertidas en los siguientes métodos:&lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; Using System.Drawing;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Image PintarEnImageBitmap(Image imageIndicador, &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; valorPorcentual)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Aquí indico que voy a crear un nuevo Bitmap de 50x50px y con un formato ARGB de 32bpp&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     Bitmap dibujoDelValor = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Bitmap(50,50,System.Drawing.Imaging.PixelFormat.Format32bppPArgb);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// A continuación creo un nuevo objeto Graphics (sobre el que voy a pintar) a partir del Bitmap anterior&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     Graphics graficoDelValor = Graphics.FromImage(dibujoDelValor);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Declaro el pincel con el que voy a pintar la circunferencia que va a rodear la gráfica de tartaa&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// incluyendo el color y el ancho del pincel        &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     System.Drawing.Pen pluma = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.Drawing.Pen(System.Drawing.Color.White,2);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Declaro la brocha con la que voy a rellenar la gráfica de tarta&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;     System.Drawing.SolidBrush brocha = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.Drawing.SolidBrush(System.Drawing.Color.White);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Limpio el gráfico con el color negro. Ojo, en Excel el transparente no vá bien.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;     graficoDelValor.Clear(System.Drawing.Color.Black);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Le indico el grado de aliasing que quiero utilizar al dibujar&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;     graficoDelValor.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Pinto la circunferencia que rodea a la gráfica de tarta&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;     graficoDelValor.DrawEllipse(pluma, 0, 0, 47, 47);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Pinto la gráfica de tarta. Invoco a un método que me transforma el valorPorcentual a grados.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// 270 es para que empiece a pintar desde una linea vertical. Ya que 0 es la horizontal derecha.&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;     graficoDelValor.FillPie(brocha, 0, 0, 47, 47, 270, PorcentajeAGrados(valorPorcentual));&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Cargo el Bitmap resultante en un objeto Image&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;     imageIndicador.Source = BitmapToSourceImage(dibujoDelValor);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;     Return imageIndicador;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;El método PorcentajeAGrados, no puede ser más sencillo:&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; PorcentajeAGrados(&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; valorPorcentual)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)(valorPorcentual * 3.6);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Y el “truco del almendruco” es pasar el Bitmap GDI+ a un tipo ImageSource, que es el que puede leer los ImageBitmap de DirectX (y que por alguna extraña causa, el programador anterior prefirió utilizar en vez de los Bitmap GDI+).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Para ello, copio y pego el código que me he encontrando googleando, y que como no me lo he apuntado no lo puedo referenciar como debería hacer.&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// Dado un objeto Bitmap lo convierte en un objeto ImageSource&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;param name="dibujoDelValor"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; System.Windows.Media.ImageSource BitmapToSourceImage(System.Drawing.Bitmap dibujoDelValor)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     System.IO.MemoryStream ms = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.IO.MemoryStream();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     dibujoDelValor.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     System.Windows.Media.Imaging.BitmapImage bImg = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.Windows.Media.Imaging.BitmapImage();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     bImg.BeginInit();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     bImg.StreamSource = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; System.IO.MemoryStream(ms.ToArray());&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     bImg.EndInit();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; bImg;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Por lo cual, y resumiendo. Una llamada de ejemplo sería:&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; Image imagenIndicador = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Image();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; imagenIndicador = PintarEnImageBitmap(imagenIndicador, 73);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Y el resultado, en el caso de la aplicación que estamos realizando es algo así:&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-QmwdSEW-AOE/UDTL4tmKU6I/AAAAAAAACfs/Ztczd_o45ek/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-Ip3a5VO-qs0/UDTL5wgWLgI/AAAAAAAACf0/ar5jxkuoyKU/image_thumb%25255B1%25255D.png?imgmax=800" width="644" height="433"&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Según me ha comentado Rodrigo, debería de investigar el no tener que hacer lo que estoy haciendo que es pintar en GDI+ y después utilizar objetos de DirectX, si no que debería pintar directamente con la propia API de Excel… pero eso es para nota. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Espero que sea de utilidad.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/v-NytU3Jjnw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/140002054801567645/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=140002054801567645" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/140002054801567645?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/140002054801567645?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/v-NytU3Jjnw/pintando-un-grafico-de-tartas-en-un.html" title="Pintando un gráfico de tartas en un ImageBitMap" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-Ip3a5VO-qs0/UDTL5wgWLgI/AAAAAAAACf0/ar5jxkuoyKU/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/08/pintando-un-grafico-de-tartas-en-un.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIGQnk6fSp7ImA9WhJQE0U.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-900962762401269831</id><published>2012-07-27T12:21:00.001+02:00</published><updated>2012-07-27T12:22:03.715+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-27T12:22:03.715+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VSTO" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><title>Workbook.Worksheets.Delete y la madre que parió a la alerta de borrado</title><content type="html">&lt;p&gt;Estoy trabajando en un AddIn para Excel, utilizando las famosas VSTO (Interop) de Offcie desde Visual Studio 2012.&lt;/p&gt; &lt;p&gt;Pulsando en un botón del Ribbon, que hemos definido, debía localizar una hoja del libro específica y borrarla. el problema es que por defecto esta acción Delete(), lanza un ventana de dialogo que te pide una confirmación&amp;nbsp; de si quieres borrar esa hoja.&lt;/p&gt; &lt;p&gt;El problema viene de que cuando pulso cancelar, no he encontrado la forma de capturar cual de los botones ha pulsado antes de que realice el borrado… y tres métodos más allá rompía la aplicación por no encontrar una hoja que se suponía que aún existía.&lt;/p&gt; &lt;p&gt;Googleando me he encontrado con una solución bruta y basta, pero que me ha valido. Y no es más que deshabilitar las ventanas de alerta y que borre de forma directa. &lt;/p&gt; &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt; &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Dado el nombre de la hoja Excel, la busca y la borra&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;param name="name"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; borraHoja(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;             Boolean seHaBorradoLaHojaExcel = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;             var addInExcel = Globals.ThisAddIn.Application;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;             addInExcel.DisplayAlerts = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;             Worksheet HojaASerBorrada = (from Worksheet hojaExcel &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; addInExcel.ActiveWorkbook.Worksheets&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;                                          &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; hojaExcel.Name == name&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;                                          select hojaExcel).FirstOrDefault();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (HojaASerBorrada != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;                 HojaASerBorrada.Delete();&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;                 seHaBorradoLaHojaExcel = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;             }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;             addInExcel.DisplayAlerts = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; seHaBorradoLaHojaExcel;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;         }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;En mi caso me ha valido porque es el comportamiento esperado, pero creo que merece un estudio en más profundidad para ver como capturar el botón que ha pulsado el usuario.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Que os sea de utilidad&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/yarCeY90Gz8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/900962762401269831/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=900962762401269831" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/900962762401269831?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/900962762401269831?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/yarCeY90Gz8/workbookworksheetsdelete-y-la-madre-que.html" title="Workbook.Worksheets.Delete y la madre que parió a la alerta de borrado" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/07/workbookworksheetsdelete-y-la-madre-que.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04HRHk4eyp7ImA9WhJTGU0.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-6172020635445219917</id><published>2012-06-28T18:45:00.002+02:00</published><updated>2012-06-28T18:45:35.733+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-28T18:45:35.733+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VSTO" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET .C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><title>Detectar MouseEnter en la capa inferior de un gráfico</title><content type="html">Buenas,&lt;br /&gt;
&lt;br /&gt;
Hoy estaba un compañero bloqueado con un problema un tanto peliagudo.&lt;br /&gt;
&lt;br /&gt;
Estamos desarrollando una Addin para Excel, en donde construimos un mapa de España dividido por provincias, y encima de cada uno de los polígonos se añaden TextBox con el nombre, un valor y dos imágenes que son unos indicadores de otros valores.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-5MK5Dw-BbT8/T-yHz2tvSjI/AAAAAAAACfU/OGeVnM1k8CE/s1600/Mapas.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="356" src="http://1.bp.blogspot.com/-5MK5Dw-BbT8/T-yHz2tvSjI/AAAAAAAACfU/OGeVnM1k8CE/s640/Mapas.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
El problema venía que cuando te pones encima del objeto o los valores, debe salir un Tooltip con datos. Y el programador anterior (Dios lo tenga en el infierno) no se le ocurrió otro modo de conseguir verlo cuando nos situamos encima del texto o el número o los indicadores que añadiendo tooltip a cada uno con la misma información. Es decir, por cada polígono llenaba de información el tooltip de cuatro controles más.&lt;br /&gt;
&lt;br /&gt;
Entonces, necesitaba eliminar los tooltip de más y decir de alguna forma, a la aplicación, que no controlara si el ratón se ponía encima de cualquier cosa que no fuera el polígono base.&lt;br /&gt;
&lt;br /&gt;
¿Y cómo hago eso?&lt;br /&gt;
&lt;br /&gt;
Lo intenté preguntandole al sender del evento OnMouseEnter a ver si me traía una colección de los objetos sobre el que estaba situado el ratón. También se lo pregunté al MouseButtonEventArgs. Y por este camino yo llegue a ningún lado.&lt;br /&gt;
&lt;br /&gt;
Asi que, en un momento de inspiración me puse a mirar los métodos y propiedades de los controles y me encontré con la solución:&lt;br /&gt;
&lt;br /&gt;
Control.IsHitTestVisible = false&lt;br /&gt;
&lt;br /&gt;
Esto hace que el objeto sea transparente para los eventos lanzados por el ratón. Lo cual produce que para el ratón solamente exista el polígono de fondo. En el ejemplo que he&amp;nbsp;traído&amp;nbsp;esto lo conseguí con:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
imageIndicador1.IsHitTestVisible = false;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;imageIndicador2.IsHitTestVisible = false;&lt;/span&gt;&lt;br /&gt;
valor1.IsHitTestVisible = false;&lt;br /&gt;
nombre.IsHitTestVisible = false;&lt;br /&gt;
path&lt;span style="background-color: white;"&gt;.IsHitTestVisible = true;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Espero que os sea&amp;nbsp;útil.&lt;/span&gt;&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/VGn_ND-0kcg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/6172020635445219917/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=6172020635445219917" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/6172020635445219917?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/6172020635445219917?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/VGn_ND-0kcg/detectar-mouseenter-en-la-capa-inferior.html" title="Detectar MouseEnter en la capa inferior de un gráfico" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-5MK5Dw-BbT8/T-yHz2tvSjI/AAAAAAAACfU/OGeVnM1k8CE/s72-c/Mapas.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/06/detectar-mouseenter-en-la-capa-inferior.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4ERnY6eSp7ImA9WhVaFE8.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-5155030522103999274</id><published>2012-06-11T16:37:00.003+02:00</published><updated>2012-06-11T17:01:47.811+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-11T17:01:47.811+02:00</app:edited><title>Descubrir los Atributos del Directorio Activo</title><content type="html">En la entrada anterior, resolví el problema que tenía para &lt;a href="http://1poquitodtodo.blogspot.com.es/2012/06/dando-de-alta-usuarios-en-el-directorio.html"&gt;dar de alta cientos de usuarios en el directorio activo por medio de un script&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Ahora el problema es que necesito rellenar más atributos que el nombre de usuario en el Directorio Activo y no tengo forma de saber cómo se llaman ni el formato esperado.&lt;br /&gt;
&lt;br /&gt;
Pero para ello también hay una solución sencilla (mira que he dado vueltas hasta llegar a los más fácil): activar una consola y añadirle el módulo adecuado.&lt;br /&gt;
&lt;br /&gt;
Lo primero abro un "&lt;i&gt;Símbolo&amp;nbsp;de Sistema&lt;/i&gt;", escribo &lt;i&gt;mmc &lt;/i&gt;y pulso &lt;i&gt;Enter&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
Se me abre una bonita consola con la Raíz&amp;nbsp;vacía.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-WB9fUhLvuu0/T9YBUin-gGI/AAAAAAAACe4/b6PQ6-EuJ-8/s1600/ConsolaDA.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="289" src="http://3.bp.blogspot.com/-WB9fUhLvuu0/T9YBUin-gGI/AAAAAAAACe4/b6PQ6-EuJ-8/s640/ConsolaDA.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Aquí pulso en el menú &lt;i&gt;Archivo -&amp;gt; Agregar o quitar elemento&lt;/i&gt;. Y se me abre una nueva ventana en donde debo pulsar el botón de &lt;i&gt;Agregar&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-xzhqg0tm_Dk/T9YCKef-wGI/AAAAAAAACfI/6ZgsY4PcOmI/s1600/ComplementosDA.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-xzhqg0tm_Dk/T9YCKef-wGI/AAAAAAAACfI/6ZgsY4PcOmI/s1600/ComplementosDA.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
En el listado que me sale busco y escojo el que dice "&lt;i&gt;Esquema de Active Directory&lt;/i&gt;" y me pongo a pulsar en los botones de "&lt;i&gt;Agregar&lt;/i&gt;" y "&lt;i&gt;Aceptar&lt;/i&gt;" que me vaya encontrando.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Y así obtengo una completa lista de todos los atributos que puedo utilizar para manipular mi Directorio Activo.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Acabo de encontrar unos enlaces muy buenos:&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Atributos del Directorio Activo de la A la Z&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/cc219751(PROT.13).aspx"&gt;http://msdn.microsoft.com/en-us/library/cc219751(PROT.13).aspx&lt;/a&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/cc220154(PROT.13).aspx"&gt;http://msdn.microsoft.com/en-us/library/cc220154(PROT.13).aspx&lt;/a&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/cc220699(PROT.13).aspx"&gt;http://msdn.microsoft.com/en-us/library/cc220699(PROT.13).aspx&lt;/a&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Espero que sea&amp;nbsp;útil.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/zkuJb2WAhis" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/5155030522103999274/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=5155030522103999274" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/5155030522103999274?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/5155030522103999274?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/zkuJb2WAhis/descubrir-los-atributos-del-directorio.html" title="Descubrir los Atributos del Directorio Activo" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-WB9fUhLvuu0/T9YBUin-gGI/AAAAAAAACe4/b6PQ6-EuJ-8/s72-c/ConsolaDA.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/06/descubrir-los-atributos-del-directorio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEFQnw-eCp7ImA9WhVaFE8.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-4251578603462071548</id><published>2012-06-11T16:23:00.000+02:00</published><updated>2012-06-11T16:23:33.250+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-11T16:23:33.250+02:00</app:edited><title>Dando de alta usuarios en el directorio activo de forma automática por script</title><content type="html">Estoy haciendo una carga de datos en el Directorio Activo que requiere +600 usuarios. Lo cual, obviamente, es un auténtico tostón hacerlo a mano.&lt;br /&gt;
&lt;br /&gt;
Por lo cual me he puesto a buscar el cómo y me he encontrado el siguiente script realizado en Visual Bascit script:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set objRootDSE = GetObject("LDAP://rootDSE")&lt;br /&gt;
&lt;br /&gt;
Set objContainer = GetObject("LDAP://cn=Users," &amp;amp; _&lt;br /&gt;
&amp;nbsp; &amp;nbsp; objRootDSE.Get("defaultNamingContext"))&lt;br /&gt;
&lt;br /&gt;
For i = 1 To 10&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Set objLeaf = objContainer.Create("User", "cn=Prefijo" &amp;amp; i)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; objLeaf.Put "sAMAccountName", "Prefijo" &amp;amp; i&lt;br /&gt;
&amp;nbsp; &amp;nbsp; objLeaf.SetInfo&lt;br /&gt;
Next&lt;br /&gt;
&lt;br /&gt;
WScript.Echo i-1 &amp;amp; " Users created."&lt;br /&gt;
&lt;br /&gt;
Esto me&amp;nbsp;va&amp;nbsp;a introducir 10 usuarios de nombre PrefijoXX en la carpeta User de mi Directorio Activo.&lt;br /&gt;
&lt;br /&gt;
Para lanzar el script, debo guardara el código en un fichero con extensión .vbs y lanzarlo dándole un doble click.&lt;br /&gt;
&lt;br /&gt;
Pero, y aquí llega el intringulis, debo saber cómo se llaman los atributos (o campos) de mi Directorioa Activo. Y hete aquí que es diferente para cada uno dependiendo de múltiples factores.&lt;br /&gt;
&lt;br /&gt;
Por lo cual, en la siguiente entrada hablaré de ello.&lt;br /&gt;
&lt;br /&gt;
Espero que sea de utilidad.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/Tc9p3XRhP-k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/4251578603462071548/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=4251578603462071548" title="0 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4251578603462071548?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4251578603462071548?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/Tc9p3XRhP-k/dando-de-alta-usuarios-en-el-directorio.html" title="Dando de alta usuarios en el directorio activo de forma automática por script" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/06/dando-de-alta-usuarios-en-el-directorio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0AEQnwyfSp7ImA9WhVQFUg.&quot;"><id>tag:blogger.com,1999:blog-5131648709766508754.post-4307744212666849313</id><published>2012-04-04T16:55:00.001+02:00</published><updated>2012-04-04T17:01:43.295+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-04T17:01:43.295+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone" /><category scheme="http://www.blogger.com/atom/ns#" term="WowHistory" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>DataContractJsonSerializer, migrando de Silverlight a WP7</title><content type="html">&lt;p&gt;El ser humano es ambicioso por defecto, y yo también lo soy.&lt;/p&gt; &lt;p&gt;Aunque como TT ya he podido obtener un LG Optimus con Windows Phone, &lt;em&gt;del cual estoy MUY contento a excepción de la falta de una oferta amplia de aplicaciones de navegación con GPS&lt;/em&gt;, me quiero apuntar a hacer aplicaciones para Windows Phone 7 a ver si me gano un Lumia 800.&lt;/p&gt; &lt;p&gt;Lo primero es encontrar una buena librería para acceder al API de Battle.NET para World of Warcraft, ya que Antonio (uno de mis compañeros de trabajo y viciado del Wow como yo), me ha dado una buena idea de aplicación.&lt;/p&gt; &lt;p&gt;He seleccionado un excelente proyecto llamado &lt;a href="http://wowsharp.codeplex.com/" target="_blank"&gt;WowSharp que está en codeplex&lt;/a&gt;, y he cogido las librerías de Silverlight para, modificándolas, poderlas utilizarlas en mi Windows Phone.&lt;/p&gt; &lt;p&gt;Estaba claro que me iba a encontrar serios problemas, pero el primero y más fácil de resolver es cuando el compilador me avisa que no sabe a qué me refiero con DataContractJsonSerializer.&lt;/p&gt; &lt;p&gt;La solución es muy simple. &lt;/p&gt; &lt;p&gt;Hay que dar de alta como referencia del proyecto a la dll: &lt;strong&gt;System.Servicemodel.Web&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-35-03-metablogapi/2728.image_5F00_2.png"&gt;&lt;/p&gt; &lt;p&gt;Y con esto ya te funciona todo.&lt;/p&gt; &lt;p&gt;Ahora, por el siguiente error.&lt;/p&gt; &lt;p&gt;P.D. La imagen es de MSDN y en &lt;a href="http://stackoverflow.com/questions/4907248/datacontractjsonserializer-on-windows-phone-7" target="_blank"&gt;stackowerflow encontré la solución&lt;/a&gt;.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/blogspot/CeSv/~4/F448ax0Fr-Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://1poquitodtodo.blogspot.com/feeds/4307744212666849313/comments/default" title="Enviar comentarios" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=5131648709766508754&amp;postID=4307744212666849313" title="1 comentarios" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4307744212666849313?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5131648709766508754/posts/default/4307744212666849313?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/CeSv/~3/F448ax0Fr-Y/datacontractjsonserializer-migrando-de.html" title="DataContractJsonSerializer, migrando de Silverlight a WP7" /><author><name>Juan Carlos Quijano Abad</name><uri>https://plus.google.com/114878507247974973759</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-rm-ZFCFa6ME/AAAAAAAAAAI/AAAAAAAAAAA/RecIw-VtPXE/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://1poquitodtodo.blogspot.com/2012/04/datacontractjsonserializer-migrando-de.html</feedburner:origLink></entry></feed>
