<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lars Hildebrandt's Blog &#187; C#</title>
	<atom:link href="http://blog.larshildebrandt.de/category/programmieren/net/csharp/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.larshildebrandt.de</link>
	<description>übers Programmieren und mehr...</description>
	<lastBuildDate>Tue, 10 Nov 2009 20:45:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fluent NHibernate mit abgeleiteten Klassen</title>
		<link>http://blog.larshildebrandt.de/fluent-nhibernate-inheritance/113.html</link>
		<comments>http://blog.larshildebrandt.de/fluent-nhibernate-inheritance/113.html#comments</comments>
		<pubDate>Thu, 19 Mar 2009 10:17:57 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[FluentNHibernate]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/?p=113</guid>
		<description><![CDATA[Gestern Abend habe ich mich mal wieder ein wenig mit Fluent NHibernate beschäftigt. Mein Ziel war es, eine Objektstruktur, die aus einer Basisklasse und zwei abgeleiteten Klassen besteht mittels Fluent NHibernate zu speichern.

Nach einigem Fehlversuchen bin ich dann zu folgendem Ergebnis gekommen:

public class KontaktMap : ClassMap&#60;Kontakt&#62;
    &#123;
      [...]]]></description>
			<content:encoded><![CDATA[<p>Gestern Abend habe ich mich mal wieder ein wenig mit Fluent NHibernate beschäftigt. Mein Ziel war es, eine Objektstruktur, die aus einer Basisklasse und zwei abgeleiteten Klassen besteht mittels Fluent NHibernate zu speichern.<br />
<img src="http://blog.larshildebrandt.de/wp-content/uploads/2009/03/20090319_fluentnhibernateinheritance.jpg" alt="" title="Objektmodell" width="430" height="325" class="alignleft size-full wp-image-114" /></p>
<p>Nach einigem Fehlversuchen bin ich dann zu folgendem Ergebnis gekommen:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> KontaktMap <span style="color: #008000;">:</span> ClassMap<span style="color: #008000;">&lt;</span>Kontakt<span style="color: #008000;">&gt;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">public</span> KontaktMap<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            Id<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">KontaktId</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">GeneratedBy</span>
                .<span style="color: #0000FF;">GuidComb</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">WithUnsavedValue</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;00000000-0000-0000-0000-000000000000&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Map<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">KontaktPerson</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            JoinedSubClass<span style="color: #008000;">&lt;</span>Brief<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;KontaktId&quot;</span>, MapBrief<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            JoinedSubClass<span style="color: #008000;">&lt;</span>Anruf<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;KontaktId&quot;</span>, MapAnruf<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> MapBrief<span style="color: #000000;">&#40;</span>JoinedSubClassPart<span style="color: #008000;">&lt;</span>Brief<span style="color: #008000;">&gt;</span> part<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            part.<span style="color: #0000FF;">Map</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Absender</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            part.<span style="color: #0000FF;">Map</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> MapAnruf<span style="color: #000000;">&#40;</span>JoinedSubClassPart<span style="color: #008000;">&lt;</span>Anruf<span style="color: #008000;">&gt;</span> part<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            part.<span style="color: #0000FF;">Map</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Telefonnummer</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            part.<span style="color: #0000FF;">Map</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Bemerkung</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>  
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Hier das vollständige Beispiel: <a href='http://blog.larshildebrandt.de/wp-content/uploads/2009/03/20090319_fluentnhibernateinheritance.zip'>Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/fluent-nhibernate-inheritance/113.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fluent NHibernate</title>
		<link>http://blog.larshildebrandt.de/fluent-nhibernate/105.html</link>
		<comments>http://blog.larshildebrandt.de/fluent-nhibernate/105.html#comments</comments>
		<pubDate>Fri, 13 Mar 2009 14:42:23 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[FluentNHibernate]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/?p=105</guid>
		<description><![CDATA[Habt ihr Euch auch schon einmal darüber geärgert, wieder diese unschönen XML-Dateien für das Mapping von NHibernate schreiben zu müssen? Seit kurzem gibt es gegen diese Unschönheit eine Lösung. Fluent NHibernate bietet Euch die Möglichkeit Eure Mappings &#8220;strongly typed&#8221; zu definieren. Anstatt der hbm.xml-Datei gibt es mit Fluent NHibernate eine Mapping-Klasse.
Die Klasse Person mit einer [...]]]></description>
			<content:encoded><![CDATA[<p>Habt ihr Euch auch schon einmal darüber geärgert, wieder diese unschönen XML-Dateien für das Mapping von NHibernate schreiben zu müssen? Seit kurzem gibt es gegen diese Unschönheit eine Lösung. Fluent NHibernate bietet Euch die Möglichkeit Eure Mappings &#8220;strongly typed&#8221; zu definieren. Anstatt der hbm.xml-Datei gibt es mit Fluent NHibernate eine Mapping-Klasse.</p>
<p>Die Klasse Person mit einer Liste von Adressen</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Person
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> Guid PersonId <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Vorname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Nachname <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> IList<span style="color: #008000;">&lt;</span>Adresse<span style="color: #008000;">&gt;</span> Adressen <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>kann dann wie folgt gemappt werden.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> PersonMap <span style="color: #008000;">:</span> ClassMap<span style="color: #008000;">&lt;</span>Person<span style="color: #008000;">&gt;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">public</span> PersonMap<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            Id<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">PersonId</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">GeneratedBy</span>
                .<span style="color: #0000FF;">GuidComb</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">WithUnsavedValue</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;00000000-0000-0000-0000-000000000000&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Map<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Vorname</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">WithLengthOf</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">50</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Map<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Nachname</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">WithLengthOf</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">50</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            HasMany<span style="color: #008000;">&lt;</span>Adresse<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Adressen</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">Access</span>.<span style="color: #0000FF;">AsProperty</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AsBag</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">WithKeyColumn</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;PersonId&quot;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">Cascade</span>.<span style="color: #0000FF;">All</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>Aber welche Vorteile biete die Fluent-Variante?</p>
<p>1. Die XML-Mapping-Dateien können nicht vom Compiler geprüft werden. Fehlkonfigurationen fallen erst zu Laufzeit auf (Exception)<br />
2. Mapping-Klassen werden wie alle anderen Klassen vom Compiler geprüft. Fehler fallen zu Entwurfszeit auf.<br />
3. Beim Umbennen von Feldern in Klassen über die Refactoring-Möglichkeiten von Visual Studio bzw. Erweiterungen werden die Felder in den Mapping-Klassen ebenfalls umbenannt. Bei den XML-Mappings müsste das händisch gemacht werden.<br />
4. Fluent-Mappings sind deutlich kürzer bzw. deutlich besser lesbar.</p>
<p>Auch die Konfiguration von NHibernate kann über eine FluentVariante realisiert werden.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">    ISessionFactory sessionFactory <span style="color: #008000;">=</span> Fluently
        .<span style="color: #0000FF;">Configure</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        .<span style="color: #0000FF;">Database</span><span style="color: #000000;">&#40;</span>SQLiteConfiguration.<span style="color: #0000FF;">Standard</span>.<span style="color: #0000FF;">UsingFile</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Beispiel.db&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        .<span style="color: #0000FF;">Mappings</span><span style="color: #000000;">&#40;</span>m <span style="color: #008000;">=&gt;</span> m.<span style="color: #0000FF;">FluentMappings</span>.<span style="color: #0000FF;">AddFromAssemblyOf</span><span style="color: #008000;">&lt;</span>Person<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        .<span style="color: #0000FF;">BuildSessionFactory</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Unter <a href="http://fluentnhibernate.org/" >http://fluentnhibernate.org/</a> kann man sich die aktuelle Version der NHibernate-Erweitung laden und mit der neuen XML-freien Variante von Mappings anfreunden. </p>
<p>Das komplette Beispiel gibt es <a href='http://blog.larshildebrandt.de/wp-content/uploads/2009/03/20090313_fluentnhibernate.zip'>hier</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/fluent-nhibernate/105.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HudsonTray &#8211; A Hudson Tray Application</title>
		<link>http://blog.larshildebrandt.de/hudson_tray/95.html</link>
		<comments>http://blog.larshildebrandt.de/hudson_tray/95.html#comments</comments>
		<pubDate>Mon, 15 Dec 2008 17:51:59 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Build-Server]]></category>
		<category><![CDATA[Composite Application Library]]></category>
		<category><![CDATA[Continuous Integretion]]></category>
		<category><![CDATA[Hudson]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/?p=95</guid>
		<description><![CDATA[Unsere Java-Truppe hat uns vor ein paar Tagen ihren Continuous Integretion Server Hudson gezeigt. Wir waren sehr davon angetan, wie einfach dieses System zu bedienen ist. Als sie uns sagten, das Hudson auch .net-Projekte bauen kann, wurden wir hellhörig.
Kurze Zeit später hatten wir auf einer VM ein Testsystem online, welches für erste Vergleichstest herhalten musste. [...]]]></description>
			<content:encoded><![CDATA[<p>Unsere Java-Truppe hat uns vor ein paar Tagen ihren Continuous Integretion Server <a href="https://hudson.dev.java.net/" target="_blank">Hudson</a> gezeigt. Wir waren sehr davon angetan, wie einfach dieses System zu bedienen ist. Als sie uns sagten, das Hudson auch .net-Projekte bauen kann, wurden wir hellhörig.<br />
Kurze Zeit später hatten wir auf einer VM ein Testsystem online, welches für erste Vergleichstest herhalten musste. Der erste Eindruck von der einfachen Bedienung bestätigte sich bei jedem neuen Projekt, das wir im System hinterlegten. Auch das Thema Unit-Test mit NUnit wird durch ein Add-In für Hudson unterstützt. Wer mal etwas tiefer in die Konfiguration von Jobs schauen möchte, kann ja mal <a href="http://redsolo.blogspot.com/2008/04/guide-to-building-net-projects-using.html" target="_blank">hier</a> gucken <img src='http://blog.larshildebrandt.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Das einzige, was mir persönlich nicht so gut gefiel, war die Tatsache, das es keine brauchbare Tray-Anwendung zur Darstellung des Status gab. Ich persönlich bin kein großer Freund von Mail-Benachrichtigungen.</p>
<p>Nach kurzem Durchsuchen der <a href="https://hudson.dev.java.net" target="_blank">Hudson-Seite</a> wurde ich auf die bereitgestellt API aufmerksam&#8230; und ein paar Abende später, war die erste Version meiner Tray-Anwendung fertig.</p>
<p><img src="http://blog.larshildebrandt.de/wp-content/uploads/2008/12/20081214_hudsontray.jpg" alt="HudsonTray-Jobs" title="HudsonTray"  /></p>
<p>Wer mehr sehen will, kann sich auch auf <a href="http://www.codeplex.com/hudsontray" target="_blank">CodePlex</a> die aktuelle Version oder auch den Source-Code runterladen.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/hudson_tray/95.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WpfSimpleChart</title>
		<link>http://blog.larshildebrandt.de/wpfsimplechart/39.html</link>
		<comments>http://blog.larshildebrandt.de/wpfsimplechart/39.html#comments</comments>
		<pubDate>Fri, 05 Sep 2008 20:15:42 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Chart]]></category>
		<category><![CDATA[Komponente]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/?p=39</guid>
		<description><![CDATA[Ich arbeitet zur Zeit in der Firma an einem Prototypen für eine neue Softwareversion. Eine Anforderung ist die transparente Darstellung von mehreren Werten in einem Balken-Diagramm. Leider gibt es für Wpf noch keine freien Komponenten, die für meine Aufgabe nutzbar wären.
Abends kam mir dann die Idee, das Problem selbst zu lösen. Gesagt getan&#8230; nach einigen [...]]]></description>
			<content:encoded><![CDATA[<p>Ich arbeitet zur Zeit in der Firma an einem Prototypen für eine neue Softwareversion. Eine Anforderung ist die transparente Darstellung von mehreren Werten in einem Balken-Diagramm. Leider gibt es für Wpf noch keine freien Komponenten, die für meine Aufgabe nutzbar wären.<br />
Abends kam mir dann die Idee, das Problem selbst zu lösen. Gesagt getan&#8230; nach einigen kleinen oder auch großen Kämpfen mit Wpf und Xaml habe ich heute endlich eine in meinen Augen vorzeigbar Version fertiggestellt.<br />
<img src="http://blog.larshildebrandt.de/wp-content/uploads/2008/09/20080905_wpfsimplechart.jpg" alt="" title="WpfSimpleChart" width="401" height="455" class="alignleft size-full wp-image-40" /></p>
<p><a href='http://blog.larshildebrandt.de/wp-content/uploads/2008/09/20080905_wpfsimplechart.rar'>WpfSimpleChart &#8211; Source</a><br />
<a href='http://blog.larshildebrandt.de/wp-content/uploads/2008/09/20080905_wpfsimplechartdemo.zip'>WpfSimpleChart &#8211; Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/wpfsimplechart/39.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neue AvalonDock Version</title>
		<link>http://blog.larshildebrandt.de/neue-avalondock-version/37.html</link>
		<comments>http://blog.larshildebrandt.de/neue-avalondock-version/37.html#comments</comments>
		<pubDate>Fri, 29 Aug 2008 22:29:25 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Docking]]></category>
		<category><![CDATA[Komponente]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/2008/08/29/neue-avalondock-version/</guid>
		<description><![CDATA[Wer im Netz nach guten Komponenten für Wpf sucht, gibt schnell sehr viel Geld aus. Das es auch anders geht, beweist uns AvalonDock. Von der Docking-Komponente für Wpf ist heute eine neue Version herausgekommen. Diese kann auf Codeplex heruntergeladen werden.
Neben einigen Bugfixes gibt es nun auch eine Dokumentation. Neben der Komponente gibt es auch noch [...]]]></description>
			<content:encoded><![CDATA[<p>Wer im Netz nach guten Komponenten für Wpf sucht, gibt schnell sehr viel Geld aus. Das es auch anders geht, beweist uns AvalonDock. Von der Docking-Komponente für Wpf ist heute eine neue Version herausgekommen. Diese kann auf <a href="http://www.codeplex.com/AvalonDock" target="_blank">Codeplex</a> heruntergeladen werden.<br />
Neben einigen Bugfixes gibt es nun auch eine Dokumentation. Neben der Komponente gibt es auch noch ein sehr schönes Beispiel, welches einem die wesentlichen Funktionen sehr veranschaulicht.</p>
<p>Ich kann nur sagen: Danke und weiter so!!!<br />
<img src='http://blog.larshildebrandt.de/wp-content/uploads/2008/08/20080830_avalondock.png' alt='AvalonDock' /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/neue-avalondock-version/37.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sortieren der Objekte einer gebunden WPF-ListBox</title>
		<link>http://blog.larshildebrandt.de/sortieren-der-objekte-einer-gebunden-wpf-listbox/18.html</link>
		<comments>http://blog.larshildebrandt.de/sortieren-der-objekte-einer-gebunden-wpf-listbox/18.html#comments</comments>
		<pubDate>Sun, 02 Mar 2008 23:27:41 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Binding]]></category>
		<category><![CDATA[ListBox]]></category>
		<category><![CDATA[Sort]]></category>
		<category><![CDATA[SortDescriptions]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/2008/03/03/sortieren-der-objekte-einer-gebunden-wpf-listbox/</guid>
		<description><![CDATA[Und wieder einmal musste ich &#8220;recht&#8221; lange suchen um eine vermeidlich einfache Problematik zu klären. Diesmal wollte ich per Button die Einträge einer WPF-ListBox aufwärts bzw. abwärts sortieren.
Hier das Formular:

Bei den Items der ListBox handelt es sich um eine ObservableCollection, die ich über die Eigenschaft ItemsSource an die ListBox gebunden habe.Im Eventhandler der Buttons habe [...]]]></description>
			<content:encoded><![CDATA[<p>Und wieder einmal musste ich &#8220;recht&#8221; lange suchen um eine vermeidlich einfache Problematik zu klären. Diesmal wollte ich per Button die Einträge einer WPF-ListBox aufwärts bzw. abwärts sortieren.<br />
Hier das Formular:<br />
<img src='http://blog.larshildebrandt.de/wp-content/uploads/2008/03/20080303_listboxbinding.jpg' alt='ListBoxBinding' /><br />
Bei den Items der ListBox handelt es sich um eine ObservableCollection, die ich über die Eigenschaft ItemsSource an die ListBox gebunden habe.<br />Im Eventhandler der Buttons habe ich folgenden Code hinterlegt:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">lbxProjects.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">SortDescriptions</span>.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
lbxProjects.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">SortDescriptions</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> SortDescription<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;ProjectName&quot;</span>, ListSortDirection.<span style="color: #0000FF;">Ascending</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
lbxProjects.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">SortDescriptions</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> SortDescription<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Count&quot;</span>, ListSortDirection.<span style="color: #0000FF;">Ascending</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>bzw.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">lbxProjects.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">SortDescriptions</span>.<span style="color: #0000FF;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
lbxProjects.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">SortDescriptions</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> SortDescription<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;ProjectName&quot;</span>, ListSortDirection.<span style="color: #0000FF;">Descending</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
lbxProjects.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">SortDescriptions</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> SortDescription<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Count&quot;</span>, ListSortDirection.<span style="color: #0000FF;">Descending</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Über die Eigenschaft &#8220;SortDescriptions&#8221; kann man sehr komfortabel festlegen, wie die Liste sortiert werden soll. In meinem Beispiel sortiere ich zuerst nach dem Projektnamen und dann nach der Anzahl, wodurch sich folgendes Bild ergibt:<br /><img src='http://blog.larshildebrandt.de/wp-content/uploads/2008/03/20080303_listboxbinding2.jpg' alt='ListBoxBinding2' /><br />
<br />
Hier der Source für Visual Studio 2008: <a href='http://blog.larshildebrandt.de/wp-content/uploads/2008/03/20080303_sortinglistbox.zip' title='20080303_sortinglistbox.zip'>Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/sortieren-der-objekte-einer-gebunden-wpf-listbox/18.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binding eines Enums an mehrere RadioButtons</title>
		<link>http://blog.larshildebrandt.de/binding-eines-enums-an-mehrere-radiobuttons/14.html</link>
		<comments>http://blog.larshildebrandt.de/binding-eines-enums-an-mehrere-radiobuttons/14.html#comments</comments>
		<pubDate>Sat, 01 Mar 2008 17:28:40 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Binding]]></category>
		<category><![CDATA[Enum]]></category>
		<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[ValueConverter]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/2008/03/01/binding-eines-enums-an-mehrere-radiobuttons/</guid>
		<description><![CDATA[Bei einem meiner WPF-Projekte ergab sich die Problematik, das ich ein Enum an mehrere RadioButtons binden wollte. Nach recht langer Suche und einigen Versuchen habe ich einen Lösungsweg gefunden, den ich hier an einem kleinen Beispiel zeigen will. Den Source für den ValueConverter habe ich mir nicht ausgedacht. Beim googlen nach der Lösung habe ich [...]]]></description>
			<content:encoded><![CDATA[<p>Bei einem meiner WPF-Projekte ergab sich die Problematik, das ich ein Enum an mehrere RadioButtons binden wollte. Nach recht langer Suche und einigen Versuchen habe ich einen Lösungsweg gefunden, den ich hier an einem kleinen Beispiel zeigen will. Den Source für den ValueConverter habe ich mir nicht ausgedacht. Beim googlen nach der Lösung habe ich durch Zufall diese <a href="http://blogs.wankuma.com/naka/archive/2007/09/16/96518.aspx" target="blank">Seite</a> gefunden und den darauf befindlichen Source verwendet.</p>
<p>Ausgangspunkt ist einen kleine Klasse und ein Enum</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">enum</span> ProjectStatus 
<span style="color: #000000;">&#123;</span>
    InVorbereitung,
    InArbeit,
    Abgeschlossen
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Project
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> ProjectName <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> ProjectStatus Status <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><span id="more-14"></span><br />
Nun soll diese Klasse per Binding in einem WPF-Window dargestellt werden.<br />
Dafür erstellen wir ein Exemplar der Klasse im Constructor des Windows und weise es dem DataContext zu:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Project project <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Project<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
project.<span style="color: #0000FF;">ProjectName</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;RadioButton Binding Test&quot;</span><span style="color: #008000;">;</span>
project.<span style="color: #0000FF;">Status</span> <span style="color: #008000;">=</span> ProjectStatus.<span style="color: #0000FF;">InArbeit</span><span style="color: #008000;">;</span>  
DataContext <span style="color: #008000;">=</span> project<span style="color: #008000;">;</span></pre></div></div>

<p>Und nun kann im Xaml alles entsprechend gebunden werden. Dabei sollen alle möglichen Enum-Werte als RadioButtons dargestellt werden. Hier das Formular ohne Werte: <img src='http://blog.larshildebrandt.de/wp-content/uploads/2008/03/20080301_radiobuttonbinding_empty.jpg' alt='Das leere Formular' /><br />
Hier der vollständige Xaml-Code</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Window</span> <span style="color: #000066;">x:Class</span>=<span style="color: #ff0000;">&quot;WPFRadioButtonBinding.frmMain&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:x</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:c</span>=<span style="color: #ff0000;">&quot;clr-namespace:WPFRadioButtonBinding&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">Title</span>=<span style="color: #ff0000;">&quot;Binding&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">Height</span>=<span style="color: #ff0000;">&quot;150&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">Width</span>=<span style="color: #ff0000;">&quot;250&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Window.Resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;c:EnumBooleanConverter</span> <span style="color: #000066;">x:Key</span>=<span style="color: #ff0000;">&quot;enumBooleanConverter&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Window.Resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;StackPanel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Label</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;2,0,0,0&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;lblProjectName&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Content</span>=<span style="color: #ff0000;">&quot;ProjectName&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextBox</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;2,0,0,0&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;txtProjectName&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Text</span>=<span style="color: #ff0000;">&quot;{Binding ProjectName}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RadioButton</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;2&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;radInVorbereitung&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Content</span>=<span style="color: #ff0000;">&quot;InVorbereitung&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">IsChecked</span>=<span style="color: #ff0000;">&quot;{Binding Path=Status, Converter={StaticResource enumBooleanConverter}, ConverterParameter=InVorbereitung}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RadioButton</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;2&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;radInArbeit&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Content</span>=<span style="color: #ff0000;">&quot;InArbeit&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">IsChecked</span>=<span style="color: #ff0000;">&quot;{Binding Path=Status, Converter={StaticResource enumBooleanConverter}, ConverterParameter=InArbeit}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RadioButton</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;2&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;radAbgeschlossen&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Top&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Content</span>=<span style="color: #ff0000;">&quot;Abgeschlossen&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">IsChecked</span>=<span style="color: #ff0000;">&quot;{Binding Path=Status, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Abgeschlossen}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextBlock</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Margin</span>=<span style="color: #ff0000;">&quot;2&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;txtStatus&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">VerticalAlignment</span>=<span style="color: #ff0000;">&quot;Bottom&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">Text</span>=<span style="color: #ff0000;">&quot;{Binding Status}&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">HorizontalAlignment</span>=<span style="color: #ff0000;">&quot;Left&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/StackPanel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Window<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Der Trick ist beim Binding des Enums an die RadioButtons. Hierfür wird ein ValueConverter verwendet, der per Parameter &#8220;gesagt&#8221; bekommt, um welchen Wert es sich handet. Der ValueConverter &#8220;entscheidet dann, on es sich um den richtigen Wert handelt oder auch nicht&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">IsChecked=&quot;{Binding Path=Status, Converter={StaticResource enumBooleanConverter}, ConverterParameter=InVorbereitung}&quot;/&gt;</pre></div></div>

<p>Hier noch der Source für den ValueConverter:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">&nbsp;
<span style="color: #FF0000;">class</span> EnumBooleanConverter <span style="color: #008000;">:</span> IValueConverter
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080;">#region IValueConverter Members</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">object</span> Convert<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> value, Type targetType, <span style="color: #FF0000;">object</span> parameter, <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span>.<span style="color: #0000FF;">CultureInfo</span> culture<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #FF0000;">string</span> ParameterString <span style="color: #008000;">=</span> parameter <span style="color: #0600FF;">as</span> string<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ParameterString <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">return</span> DependencyProperty.<span style="color: #0000FF;">UnsetValue</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">Enum</span>.<span style="color: #0000FF;">IsDefined</span><span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, value<span style="color: #000000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">return</span> DependencyProperty.<span style="color: #0000FF;">UnsetValue</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #FF0000;">object</span> paramvalue <span style="color: #008000;">=</span> <span style="color: #FF0000;">Enum</span>.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">GetType</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, ParameterString<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>paramvalue.<span style="color: #0000FF;">Equals</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">return</span> true<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">else</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">return</span> false<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">object</span> ConvertBack<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> value, Type targetType, <span style="color: #FF0000;">object</span> parameter, <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span>.<span style="color: #0000FF;">CultureInfo</span> culture<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #FF0000;">string</span> ParameterString <span style="color: #008000;">=</span> parameter <span style="color: #0600FF;">as</span> string<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ParameterString <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">return</span> DependencyProperty.<span style="color: #0000FF;">UnsetValue</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0600FF;">return</span> <span style="color: #FF0000;">Enum</span>.<span style="color: #0000FF;">Parse</span><span style="color: #000000;">&#40;</span>targetType, ParameterString<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span> 
    <span style="color: #008080;">#endregion</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>
Hier der vollständige Source (Visual Studio 2008): <a href='http://blog.larshildebrandt.de/wp-content/uploads/2008/03/20080301_wpfradiobuttonbinding.zip' title='wpfradiobuttonbinding.zip'>Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/binding-eines-enums-an-mehrere-radiobuttons/14.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ändern von Visual Studio Einstellungen über ein &#8220;Visual Studio Integration Package&#8221;</title>
		<link>http://blog.larshildebrandt.de/andern-von-visual-studio-einstellungen-uber-ein-visual-studio-integration-package/9.html</link>
		<comments>http://blog.larshildebrandt.de/andern-von-visual-studio-einstellungen-uber-ein-visual-studio-integration-package/9.html#comments</comments>
		<pubDate>Sun, 20 Jan 2008 00:17:27 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Erweiterung]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/2008/01/20/andern-von-visual-studio-einstellungen-uber-ein-visual-studio-integration-package/</guid>
		<description><![CDATA[Vor ein paar Tagen habe ich mich mal mit der Frage auseinandergesetzt, wie man mit Hilfe der DTE in einen vsPackage Einstellungen ändern kann. Auslöser dafür war der Wunsch meines Kollegen Tobi, die Einstellungen für das Debugging mit Hilfe des SourceServers von Microsoft auf einfache Art und Weise ein und ausschalten zu können. Die Einstellungen [...]]]></description>
			<content:encoded><![CDATA[<p>Vor ein paar Tagen habe ich mich mal mit der Frage auseinandergesetzt, wie man mit Hilfe der DTE in einen vsPackage Einstellungen ändern kann. Auslöser dafür war der Wunsch meines Kollegen Tobi, die Einstellungen für das Debugging mit Hilfe des SourceServers von Microsoft auf einfache Art und Weise ein und ausschalten zu können. Die Einstellungen jedes Mal über die Tools -> Options anzupassen dauert einfach zu lange.</p>
<p>Einfach ein Visual Studio Integration Package über File->New&#8230;->Projects->Extensibility anlegen und in die Methode &#8220;MenuItemCallback&#8221; folgende Code schreiben bzw. kopieren:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">bool</span><span style="color: #008000;">?</span> serverSupport <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
&nbsp;
DTE dte <span style="color: #008000;">=</span> GetService<span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>DTE<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">as</span> DTE<span style="color: #008000;">;</span>
Properties properties <span style="color: #008000;">=</span> dte.<span style="color: #0000FF;">get_Properties</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Debugging&quot;</span>, <span style="color: #666666;">&quot;General&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">// suchen der richtigen Einstellungen</span>
<span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>EnvDTE.<span style="color: #0000FF;">Property</span> prop <span style="color: #0600FF;">in</span> properties<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>prop.<span style="color: #0000FF;">Name</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;EnableJustMyCode&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        prop.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> <span style="color: #008000;">!</span>Convert.<span style="color: #0000FF;">ToBoolean</span><span style="color: #000000;">&#40;</span>prop.<span style="color: #0000FF;">Value</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        serverSupport <span style="color: #008000;">=</span> <span style="color: #008000;">!</span>Convert.<span style="color: #0000FF;">ToBoolean</span><span style="color: #000000;">&#40;</span>prop.<span style="color: #0000FF;">Value</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>prop.<span style="color: #0000FF;">Name</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;EnableSourceServer&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>serverSupport.<span style="color: #0000FF;">HasValue</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            prop.<span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> serverSupport.<span style="color: #0000FF;">Value</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>MenuCommand<span style="color: #000000;">&#41;</span>sender<span style="color: #000000;">&#41;</span>.<span style="color: #008000;">Checked</span> <span style="color: #008000;">=</span> serverSupport.<span style="color: #0000FF;">Value</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/andern-von-visual-studio-einstellungen-uber-ein-visual-studio-integration-package/9.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fehler beim Erzeugen von Attributen über EnvDTE</title>
		<link>http://blog.larshildebrandt.de/fehler-beim-erzeugen-von-attributen-uber-envdte/8.html</link>
		<comments>http://blog.larshildebrandt.de/fehler-beim-erzeugen-von-attributen-uber-envdte/8.html#comments</comments>
		<pubDate>Thu, 10 Jan 2008 07:31:15 +0000</pubDate>
		<dc:creator>Lars Hildebrandt</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Erweiterung]]></category>

		<guid isPermaLink="false">http://blog.larshildebrandt.de/2008/01/10/fehler-beim-erzeugen-von-attributen-uber-envdte/</guid>
		<description><![CDATA[Beim Versuch mein vsPackage für die Implementierung von Interfaces ein wenig zu erweitern, bin ich auch ein seltsames Problem gestoßen.
Über die vom AddIn erzeugten Getter und Setter wollte ich ein Attribute per Code setzen. Hierfür gibt es eigentlich die Methode &#8220;AddAttribute&#8221;&#8230;Gesagt getan&#8230;hier der Code:

CodeFunction getter = prop.Getter;
getter.Attributes&#40;&#34;MyAttribute&#34;, &#34;myValue&#34;, -1&#41;;

Der Compiler erzeugt alles ganz brav und [...]]]></description>
			<content:encoded><![CDATA[<p>Beim Versuch mein vsPackage für die Implementierung von Interfaces ein wenig zu erweitern, bin ich auch ein seltsames Problem gestoßen.<br />
Über die vom AddIn erzeugten Getter und Setter wollte ich ein Attribute per Code setzen. Hierfür gibt es eigentlich die Methode &#8220;AddAttribute&#8221;&#8230;Gesagt getan&#8230;hier der Code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">CodeFunction getter <span style="color: #008000;">=</span> prop.<span style="color: #0000FF;">Getter</span><span style="color: #008000;">;</span>
getter.<span style="color: #0000FF;">Attributes</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;MyAttribute&quot;</span>, <span style="color: #666666;">&quot;myValue&quot;</span>, <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Der Compiler erzeugt alles ganz brav und startet das vsPackage im Visual Studio Hive. Alles fein&#8230;naja vielleicht bis auf, wenn man das AddIn benutzen will.<br />
An besagter Stelle kommt eine sehr aussagekräftige Exception mit der Meldung &#8220;Unbekannter Fehler&#8221;. Komisch ist nur, das die Methode wohl nur auf den Gettern bzw. Settern(CodeFunction) Probleme macht. Bei &#8220;CodeProperty&#8221; bzw. &#8220;CodeClass&#8221; funktioniert alles wunderbar&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.larshildebrandt.de/fehler-beim-erzeugen-von-attributen-uber-envdte/8.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
