<?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>Yohan Jasdid&#039;s Blog &#38; Stories &#187; Bits</title>
	<atom:link href="http://yohan.jasdid.com/http:/yohan.jasdid.com/bits/feed/" rel="self" type="application/rss+xml" />
	<link>http://yohan.jasdid.com</link>
	<description>Around the world..</description>
	<lastBuildDate>Thu, 26 Aug 2010 16:45:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Caliburn y Silverlight ejemplo sencillo..</title>
		<link>http://yohan.jasdid.com/2010/06/caliburn-y-silverlight-ejemplo-sencillo/</link>
		<comments>http://yohan.jasdid.com/2010/06/caliburn-y-silverlight-ejemplo-sencillo/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 22:34:02 +0000</pubDate>
		<dc:creator>yohan.jasdid</dc:creator>
				<category><![CDATA[Bits]]></category>
		<category><![CDATA[Caliburn]]></category>
		<category><![CDATA[MVVM Framework]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[Splitter]]></category>

		<guid isPermaLink="false">http://yohan.jasdid.com/?p=864</guid>
		<description><![CDATA[Estos ultimos dias he estado checando Caliburn (MVVM framework) debido a la posibilidad de trabajar con el en un futuro cercano, asi que he decidido postear un muy parecido ejemplo al que publique hace poco donde trabajaban un expander y un splitter de manera conjunta, ahora como estoy utilizando Silverlight pues voy a deberles el [...]]]></description>
			<content:encoded><![CDATA[<p>Estos ultimos dias he estado checando Caliburn (MVVM framework) debido a la posibilidad de trabajar con el en un futuro cercano, asi que he decidido postear un muy parecido ejemplo al que publique hace poco donde trabajaban un expander y un splitter de manera conjunta, ahora como estoy utilizando Silverlight pues voy a deberles el expander ya que al parecer ese control no es soportado por esta tecnologia <img src='http://yohan.jasdid.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  tal vez en el Silverlight Toolkit venga uno pero ese sera un tema para despues..</p>
<p>Caliburn me ha dejado impresionado con la cantidad de cosas que puedes hacer con tan poco codigo debido a la manera que esta diseniado el framework practicamente te permite enlazar controles y eventos y un monton de cosas que hace por ti detras del telon, lo unico malo es que la documentacion no es muy extensa y no existen tantas aplicaciones como ejemplo o quickstarts (como PRISM por ejemplo) asi que habra que contribuir con un granito de arena en la promocion de este excelente framework.</p>
<p>Bueno para empezar debemos crear un nuevo proyecto de tipo Silverlight, yo estoy utilizando el VS2010 y el Silverlight 4 que es una instalacion separada, una vez creado este proyecto y configurado automaticamente por Visual Studio removemos el control MainWindow.xaml y lo reemplazamos por ShellView.xaml que sera nuestro contenedor de contenido, a continuacion lo configuramos de la siguiente manera en el App.xaml principal para soportar Caliburn,</p>
<p>App.xaml</p>
<pre class="brush: plain;">
&lt;am:CaliburnApplication
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:am=&quot;clr-namespace:Caliburn.PresentationFramework.ApplicationModel;assembly=Caliburn.PresentationFramework&quot;
    x:Class=&quot;ExpanderAndSplitter.Caliburn.App&quot;&gt;

    &lt;!--This is a caliburn application --&gt;
    &lt;Application.Resources&gt;
    &lt;/Application.Resources&gt;
&lt;/am:CaliburnApplication&gt;
</pre>
<p>Y a continuacion modificamos el code behind para que derive de la clase CaliburnApplication,<br />
App.xaml.cs</p>
<pre class="brush: csharp;">
using ExpanderAndSplitter.Caliburn.ViewModels;
using Caliburn.PresentationFramework.ApplicationModel;

namespace ExpanderAndSplitter.Caliburn
{
     public partial class App :  CaliburnApplication
    {

        public App()
        {
            InitializeComponent();
        }

        /// &lt;summary&gt;
        /// Creating the root view model of the app, the shell
        /// &lt;/summary&gt;
        /// &lt;returns&gt;Root view model (shell)&lt;/returns&gt;
        protected override object CreateRootModel()
        {
            return new ShellViewModel();
        }

     }
}
</pre>
<p>En los pasos anteriores definimos la applicacion como un applicacion Caliburn y a continuacion hacemos Override al CreatRootModel() donde le diremos a Caliburn cual es el objeto de la vista que queremos como Root object o sea como contenedor principal de la aplicacion, cabe mencionar que caliburn es orientado a modelos y majena mucho el concepto de convenciones por lo que el framework detras del telon hara una serie de comprobaciones para ubicar la vista que pertenece al &#8220;ViewModel&#8221; que especificamos como contenedor principal en el Override por lo que no tendremos que hacer nada especial para que la vista de tal modelo este bindeada al modelo, MAGIA PURA!!!</p>
<p>ShellViewModel.cs</p>
<pre class="brush: csharp;">
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Caliburn.Core;
using System.Collections.ObjectModel;
using ExpanderAndSplitter.Caliburn.Models;

namespace ExpanderAndSplitter.Caliburn.ViewModels
{
    public class ShellViewModel : PropertyChangedBase
    {

        #region Fields

        private GridLength _masterRowHeight = new GridLength(1, GridUnitType.Star);
        private GridLength _splitterRowHeight = new GridLength(0);
        private GridLength _detailRowHeight = new GridLength(1, GridUnitType.Auto);

        public ObservableCollection&lt;ItemViewModel&gt; _masterItems = null;
        public ObservableCollection&lt;ItemViewModel&gt; _detailItems = null;

        #endregion // Fields

        public ShellViewModel()
        {
            MasterRowHeight = new GridLength(1, GridUnitType.Star);
            SplitterRowHeight = new GridLength(20);
            DetailRowHeight = new GridLength(1, GridUnitType.Star);

            MasterItems = new ObservableCollection&lt;ItemViewModel&gt;();
            DetailItems = new ObservableCollection&lt;ItemViewModel&gt;();

            for (int i = 0; i &lt; 1000; i++)
            {
                ItemModel masterIM = new ItemModel(&quot;Master Item Dummy &quot; + i.ToString(), i.ToString());
                ItemModel detailIM = new ItemModel(&quot;Detail Item Dummy &quot; + i.ToString(), i.ToString());

                ItemViewModel masterIVM = new ItemViewModel(masterIM);
                ItemViewModel detailIVM = new ItemViewModel(detailIM);

                MasterItems.Add(masterIVM);
                DetailItems.Add(detailIVM);
            }

        }

        #region Properties

        public GridLength MasterRowHeight
        {
            get { return _masterRowHeight; }
            set
            {
                _masterRowHeight = value;
                NotifyOfPropertyChange(&quot;MasterRowHeight&quot;);
            }
        }

        public GridLength SplitterRowHeight
        {
            get { return _splitterRowHeight; }
            set
            {
                _splitterRowHeight = value;
                NotifyOfPropertyChange(&quot;SplitterRowHeight&quot;);
            }
        }

        public GridLength DetailRowHeight
        {
            get { return _detailRowHeight; }
            set
            {
                _detailRowHeight = value;
                NotifyOfPropertyChange(&quot;DetailRowHeight&quot;);
            }
        }

        public ObservableCollection&lt;ItemViewModel&gt; MasterItems
        {
            get { return _masterItems; }
            set
            {
                _masterItems = value;
                NotifyOfPropertyChange(&quot;MasterItems&quot;);
            }
        }

        public ObservableCollection&lt;ItemViewModel&gt; DetailItems
        {
            get { return _detailItems; }
            set
            {
                _detailItems = value;
                NotifyOfPropertyChange(&quot;DetailItems&quot;);
            }
        }

        #endregion // Properties

    }
}
</pre>
<p>Siguiendo las convenciones definidas por el framework por default sabemos que las vistas deberan estar situadas en una carpeta llamada Views, los ViewModels al igual deberan estar en su carpeta llamada ViewModels, siendo todo esto configurable, ademas con el codigo fuente podemos definir nuestras propias convenciones <img src='http://yohan.jasdid.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>ShellView.xaml</p>
<pre class="brush: plain;">
&lt;UserControl x:Class=&quot;ExpanderAndSplitter.Caliburn.Views.ShellView&quot;
    xmlns:sdk=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk&quot;
    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;
    xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;
    mc:Ignorable=&quot;d&quot;
    d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;400&quot;&gt;

    &lt;Grid x:Name=&quot;MainContainer&quot; Margin=&quot;5,5,5,5&quot; VerticalAlignment=&quot;Stretch&quot;
          HorizontalAlignment=&quot;Stretch&quot; Background=&quot;Transparent&quot;&gt;
        &lt;Grid.ColumnDefinitions&gt;
            &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt;
            &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt;
            &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt;
            &lt;ColumnDefinition Width=&quot;*&quot; /&gt;
            &lt;ColumnDefinition Width=&quot;Auto&quot; /&gt;
        &lt;/Grid.ColumnDefinitions&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height=&quot;Auto&quot;/&gt;
            &lt;RowDefinition Height=&quot;*&quot;/&gt;
        &lt;/Grid.RowDefinitions&gt;

        &lt;sdk:Label x:Name=&quot;DummyLabel&quot; Content=&quot;Dummy Label&quot; /&gt;
        &lt;ComboBox x:Name=&quot;DummyComboBox&quot; Grid.Column=&quot;1&quot; MinWidth=&quot;100&quot;
                      Margin=&quot;0,0,5,0&quot;/&gt;

        &lt;Button Grid.Column=&quot;2&quot; Width=&quot;100&quot; Content=&quot;Dummy Button&quot; /&gt;
        &lt;sdk:Label x:Name=&quot;Label&quot; Content=&quot;Dummy Label 2&quot; Grid.Column=&quot;4&quot; HorizontalAlignment=&quot;Right&quot; /&gt;

        &lt;Grid Grid.Row=&quot;1&quot; Grid.ColumnSpan=&quot;5&quot; Margin=&quot;0,5,0,0&quot;
              VerticalAlignment=&quot;Stretch&quot; HorizontalAlignment=&quot;Stretch&quot; Background=&quot;Transparent&quot;&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition /&gt;
            &lt;/Grid.ColumnDefinitions&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition x:Name=&quot;MasterRow&quot; Height=&quot;{Binding MasterRowHeight, Mode=TwoWay}&quot; /&gt;
                &lt;RowDefinition x:Name=&quot;SplitterRow&quot; Height=&quot;{Binding SplitterRowHeight, Mode=TwoWay}&quot; /&gt;
                &lt;RowDefinition x:Name=&quot;DetailRow&quot; Height=&quot;{Binding DetailRowHeight, Mode=TwoWay}&quot; /&gt;
            &lt;/Grid.RowDefinitions&gt;

            &lt;Grid Background=&quot;Transparent&quot;&gt;
                &lt;Grid.ColumnDefinitions&gt;
                    &lt;ColumnDefinition Width=&quot;*&quot; /&gt;
                &lt;/Grid.ColumnDefinitions&gt;
                &lt;Grid.RowDefinitions&gt;
                    &lt;RowDefinition Height=&quot;*&quot;/&gt;
                &lt;/Grid.RowDefinitions&gt;

                &lt;sdk:DataGrid x:Name=&quot;MasterGrid&quot;
                            AutoGenerateColumns=&quot;False&quot;
                            ColumnWidth=&quot;*&quot;
                            HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot;
                            ItemsSource=&quot;{Binding MasterItems}&quot;&gt;

                    &lt;sdk:DataGrid.Columns&gt;
                        &lt;sdk:DataGridTextColumn Binding=&quot;{Binding Path=Name}&quot; Header=&quot;Master Name&quot; /&gt;
                        &lt;sdk:DataGridTextColumn Binding=&quot;{Binding Path=ID}&quot; Header=&quot;ID&quot; /&gt;
                    &lt;/sdk:DataGrid.Columns&gt;
                &lt;/sdk:DataGrid&gt;
            &lt;/Grid&gt;

            &lt;sdk:GridSplitter Grid.Row=&quot;1&quot; Background=&quot;Gray&quot;
                              BorderThickness=&quot;1,1,1,1&quot; Width=&quot;Auto&quot; HorizontalAlignment=&quot;Stretch&quot;
                              Height=&quot;6&quot; VerticalContentAlignment=&quot;Top&quot;
                              Padding=&quot;0,0,0,0&quot; Margin=&quot;5,0,5,0&quot; VerticalAlignment=&quot;Center&quot;/&gt;

            &lt;Grid Background=&quot;Transparent&quot; Grid.Row=&quot;2&quot; Margin=&quot;0,5,0,0&quot; &gt;
                &lt;Grid.ColumnDefinitions&gt;
                    &lt;ColumnDefinition Width=&quot;*&quot; /&gt;
                &lt;/Grid.ColumnDefinitions&gt;
                &lt;Grid.RowDefinitions&gt;
                    &lt;RowDefinition Height=&quot;*&quot;/&gt;
                &lt;/Grid.RowDefinitions&gt;

                &lt;sdk:DataGrid x:Name=&quot;DetailGrid&quot;
                            AutoGenerateColumns=&quot;False&quot;
                            ColumnWidth=&quot;*&quot;
                            HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot;
                            ItemsSource=&quot;{Binding DetailItems}&quot;&gt;

                    &lt;sdk:DataGrid.Columns&gt;
                        &lt;sdk:DataGridTextColumn Binding=&quot;{Binding Path=Name}&quot; Header=&quot;Detail Name&quot; /&gt;
                        &lt;sdk:DataGridTextColumn Binding=&quot;{Binding Path=ID}&quot; Header=&quot;ID&quot; /&gt;
                    &lt;/sdk:DataGrid.Columns&gt;
                &lt;/sdk:DataGrid&gt;
            &lt;/Grid&gt;
        &lt;/Grid&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;
</pre>
<p>ItemModel.cs</p>
<pre class="brush: csharp;">
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ExpanderAndSplitter.Caliburn.Models
{
    public class ItemModel
    {

        public ItemModel(string name, string id)
        {
            this.Name = name;
            this.ID = id;
        }

        public string Name
        {
            get;
            set;
        }

        public string ID
        {
            get;
            set;
        }

    }
}
</pre>
<p>Al final la aplicacion luce casi igual que la del post pasado solo que utilizando Caliburn y Silverlight y a excepcion que no se tuvo que utilizar codigo para especificar la relacion entre vista y view model ya que caliburn se encarga de todo esto y muchisimo mas.</p>
<p><a href="http://yohan.jasdid.com/wp-content/uploads/2010/06/Splitter.jpg"><img class="alignnone size-medium wp-image-868" title="Splitter" src="http://yohan.jasdid.com/wp-content/uploads/2010/06/Splitter-450x407.jpg" alt="" width="450" height="407" /></a></p>
<p>Mas adelante si tengo tiempo publicare algo relacionado con los Comandos, Triggers, Efectos y un monton de cosas que puedes aprovechar con caliburn de una manera sencilla, espero les haya gustado y no duden en dejar un comentario pues tal vez hize algo mal ya que apenas son mis inicios con Caliburn.</p>
<p>Puedes bajar el codigo fuente completo y el proyecto del siguiente enlace:  <a href="http://yohan.jasdid.com/wp-content/uploads/2010/06/ExpanderAndSplitter.Caliburn.rar">ExpanderAndSplitter.Caliburn</a></p>
<p>Saludos!<br />
YR</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://yohan.jasdid.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://yohan.jasdid.com/2010/06/caliburn-y-silverlight-ejemplo-sencillo/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WPF Expander y Splitter trabajando juntos..</title>
		<link>http://yohan.jasdid.com/2010/06/wpf-expander-y-splitter-trabajando-juntos-3/</link>
		<comments>http://yohan.jasdid.com/2010/06/wpf-expander-y-splitter-trabajando-juntos-3/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 23:19:40 +0000</pubDate>
		<dc:creator>yohan.jasdid</dc:creator>
				<category><![CDATA[Bits]]></category>
		<category><![CDATA[splitter expander wpf approach]]></category>

		<guid isPermaLink="false">http://yohan.jasdid.com/?p=842</guid>
		<description><![CDATA[Bueno aqui dejo publicado la solucion de un problemita que recientemente tuve haciendo que funcionarian juntos un Expander y un splitter bueno la meta final era tener 2 expanders separados por 1 splitter y que cada expander contuviera algun tipo de grids o incluso una vista con este aproach ya se puede jugar con lo [...]]]></description>
			<content:encoded><![CDATA[<p>Bueno aqui dejo publicado la solucion de un problemita que recientemente tuve haciendo que funcionarian juntos un Expander y un splitter bueno la meta final era tener 2 expanders separados por 1 splitter y que cada expander contuviera algun tipo de grids o incluso una vista con este aproach ya se puede jugar con lo que uno quiera poner en cada region,</p>
<p>Yo anduve buscando algo similar y no pude encontrar mucho al respecto asi que aqui dejo mi solucion y espero que a alguien pueda servirle..</p>
<p>Aqui tenemos el XAML con el codigo que contiene al expander y al splitter o mas bien dos expander conteniendo un grid cada uno separados por un splitter..</p>
<pre class="brush: plain;">
&lt;window x:Class=&quot;ExpanderAndSplitter.MainWindow&quot;
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        Title=&quot;MainWindow&quot; Height=&quot;350&quot; Width=&quot;525&quot; x:Name=&quot;MainWdw&quot;&gt;

    &lt;grid x:Name=&quot;MainContainer&quot; Loaded=&quot;MainContainer_Loaded&quot; Margin=&quot;5,5,5,5&quot; VerticalAlignment=&quot;Stretch&quot;
          HorizontalAlignment=&quot;Stretch&quot; Background=&quot;Transparent&quot;&gt;
        &lt;/grid&gt;&lt;grid .ColumnDefinitions&gt;
            &lt;columndefinition Width=&quot;Auto&quot; /&gt;
            &lt;columndefinition Width=&quot;Auto&quot; /&gt;
            &lt;columndefinition Width=&quot;Auto&quot; /&gt;
            &lt;columndefinition Width=&quot;*&quot; /&gt;
            &lt;columndefinition Width=&quot;Auto&quot; /&gt;
        &lt;/grid&gt;
        &lt;grid .RowDefinitions&gt;
            &lt;rowdefinition Height=&quot;Auto&quot;/&gt;
            &lt;rowdefinition Height=&quot;*&quot;/&gt;
        &lt;/grid&gt;

        &lt;label x:Name=&quot;DummyLabel&quot; Content=&quot;Dummy Label&quot; /&gt;
        &lt;combobox x:Name=&quot;DummyComboBox&quot; Grid.Column=&quot;1&quot; MinWidth=&quot;100&quot;
                      Margin=&quot;0,0,5,0&quot;/&gt;

        &lt;button Grid.Column=&quot;2&quot; Width=&quot;100&quot; Content=&quot;Dummy Button&quot; /&gt;
        &lt;label x:Name=&quot;Label&quot; Content=&quot;Dummy Label 2&quot; Grid.Column=&quot;4&quot; HorizontalAlignment=&quot;Right&quot; /&gt;

        &lt;grid Grid.Row=&quot;1&quot; Grid.ColumnSpan=&quot;5&quot;
              VerticalAlignment=&quot;Stretch&quot; HorizontalAlignment=&quot;Stretch&quot; Background=&quot;Transparent&quot;&gt;
            &lt;/grid&gt;&lt;grid .ColumnDefinitions&gt;
                &lt;columndefinition /&gt;
            &lt;/grid&gt;
            &lt;grid .RowDefinitions&gt;
                &lt;rowdefinition x:Name=&quot;MasterRow&quot; Height=&quot;{Binding MasterRowHeight, Mode=TwoWay}&quot; /&gt;
                &lt;rowdefinition x:Name=&quot;SplitterRow&quot; Height=&quot;{Binding SplitterRowHeight, Mode=TwoWay}&quot; /&gt;
                &lt;rowdefinition x:Name=&quot;DetailRow&quot; Height=&quot;{Binding DetailRowHeight, Mode=TwoWay}&quot; /&gt;
            &lt;/grid&gt;

            &lt;expander x:Name=&quot;MasterExpander&quot; IsExpanded=&quot;True&quot;
                      BorderBrush=&quot;Gray&quot; Margin=&quot;0,5,0,0&quot;
                      BorderThickness=&quot;1&quot;  IsEnabled=&quot;True&quot;
                      ExpandDirection=&quot;Down&quot; Background=&quot;Transparent&quot;
                      Expanded=&quot;MasterExpander_Expanded&quot;
                      Collapsed=&quot;MasterExpander_Collapsed&quot; &gt;
                &lt;/expander&gt;&lt;expander .Header&gt;
                    &lt;textblock FontWeight=&quot;Bold&quot; Text=&quot;Master Region&quot; /&gt;
                &lt;/expander&gt;

                &lt;grid Background=&quot;Transparent&quot;&gt;
                    &lt;/grid&gt;&lt;grid .ColumnDefinitions&gt;
                        &lt;columndefinition Width=&quot;*&quot; /&gt;
                    &lt;/grid&gt;
                    &lt;grid .RowDefinitions&gt;
                        &lt;rowdefinition Height=&quot;*&quot;/&gt;
                    &lt;/grid&gt;

                    &lt;datagrid x:Name=&quot;MasterGrid&quot;
                              Loaded=&quot;MasterGrid_Loaded&quot;
                              AutoGenerateColumns=&quot;True&quot;
                              CanUserDeleteRows=&quot;False&quot;
                              ColumnWidth=&quot;*&quot;
                              HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot;/&gt;

            &lt;gridsplitter Grid.Row=&quot;1&quot; Background=&quot;Gray&quot;
                      BorderThickness=&quot;1,1,1,1&quot; Width=&quot;Auto&quot; HorizontalAlignment=&quot;Stretch&quot;
                      Height=&quot;6&quot; VerticalContentAlignment=&quot;Top&quot;
                      Padding=&quot;0,0,0,0&quot; Margin=&quot;5,0,5,0&quot; VerticalAlignment=&quot;Center&quot;/&gt;

            &lt;expander x:Name=&quot;DetailExpander&quot; Grid.Row=&quot;2&quot; Margin=&quot;0,5,0,0&quot;
                      BorderBrush=&quot;Gray&quot; BorderThickness=&quot;1&quot;  IsEnabled=&quot;True&quot;
                      ExpandDirection=&quot;Down&quot; Background=&quot;Transparent&quot;
                      Expanded=&quot;DetailExpander_Expanded&quot;
                      Collapsed=&quot;DetailExpander_Collapsed&quot; &gt;
                &lt;/expander&gt;&lt;expander .Header&gt;
                    &lt;textblock FontWeight=&quot;Bold&quot; Text=&quot;Detail Region&quot; /&gt;
                &lt;/expander&gt;

                &lt;grid Background=&quot;Transparent&quot;&gt;
                    &lt;/grid&gt;&lt;grid .ColumnDefinitions&gt;
                        &lt;columndefinition Width=&quot;*&quot; /&gt;
                    &lt;/grid&gt;
                    &lt;grid .RowDefinitions&gt;
                        &lt;rowdefinition Height=&quot;*&quot;/&gt;
                    &lt;/grid&gt;

                    &lt;datagrid x:Name=&quot;DetailGrid&quot;
                              Loaded=&quot;DetailGrid_Loaded&quot;
                              AutoGenerateColumns=&quot;True&quot;
                              CanUserDeleteRows=&quot;False&quot;
                              ColumnWidth=&quot;*&quot;
                              HorizontalAlignment=&quot;Stretch&quot; VerticalAlignment=&quot;Stretch&quot;/&gt;

&lt;/window&gt;
</pre>
<p>Y su respectivo code behind que se encarga de hacer las operaciones correspondientes de tamanio para que estos controles funcionen armoniosamente uno con el otro..</p>
<pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace ExpanderAndSplitter
{
    /// &lt;summary&gt;
    /// Interaction logic for MainWindow.xaml
    /// &lt;/summary&gt;
    public partial class MainWindow : Window
    {

        #region Fields

        private static double _oldMasterHeight = 1;
        private static double _oldDetailHeight = 1;

        #endregion // Fields

        #region Properties

        public GridLength MasterRowHeight
        {
            get { return (GridLength)GetValue(MasterRowHeightProperty); }
            set { SetValue(MasterRowHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MasterRowHeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MasterRowHeightProperty =
            DependencyProperty.Register(&quot;MasterRowHeight&quot;, typeof(GridLength), typeof(MainWindow), new UIPropertyMetadata(new GridLength(1, GridUnitType.Star)));

        public GridLength SplitterRowHeight
        {
            get { return (GridLength)GetValue(SplitterRowHeightProperty); }
            set { SetValue(SplitterRowHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SplitterRowHeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SplitterRowHeightProperty =
            DependencyProperty.Register(&quot;SplitterRowHeight&quot;, typeof(GridLength), typeof(MainWindow), new UIPropertyMetadata(new GridLength(0)));

        public GridLength DetailRowHeight
        {
            get { return (GridLength)GetValue(DetailRowHeightProperty); }
            set { SetValue(DetailRowHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for DetailRowHeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty DetailRowHeightProperty =
            DependencyProperty.Register(&quot;DetailRowHeight&quot;, typeof(GridLength), typeof(MainWindow), new UIPropertyMetadata(new GridLength(1, GridUnitType.Auto)));

        public ObservableCollection&lt;DummyItem&gt; MasterItems
        {
            get;
            set;
        }

        public ObservableCollection&lt;DummyItem&gt; DetailItems
        {
            get;
            set;
        }

        #endregion // Properties

        #region Constructors

        public MainWindow()
        {
            InitializeComponent();

            MasterItems = new ObservableCollection&lt;DummyItem&gt;();
            DetailItems = new ObservableCollection&lt;DummyItem&gt;();

            for (int i=0; i&lt;1000; i++)
            {
                MasterItems.Add(new DummyItem(&quot;Master Dummy &quot; + i.ToString(), i.ToString()));
                DetailItems.Add(new DummyItem(&quot;Detail Dummy &quot; + i.ToString(), i.ToString()));
            }
        }

        #endregion // Constructors

        #region Events

        private void MasterExpander_Expanded(object sender, RoutedEventArgs e)
        {
            DoHandleExpandCollapse();
        }

        private void MasterExpander_Collapsed(object sender, RoutedEventArgs e)
        {
            if (DetailExpander.IsExpanded)
            {
                _oldMasterHeight = MasterRowHeight.Value;
                _oldDetailHeight = DetailRowHeight.Value;
            }
            DoHandleExpandCollapse();
        }

        private void DetailExpander_Expanded(object sender, RoutedEventArgs e)
        {
            DoHandleExpandCollapse();
        }

        private void DetailExpander_Collapsed(object sender, RoutedEventArgs e)
        {
            if (MasterExpander.IsExpanded)
            {
                _oldMasterHeight = MasterRowHeight.Value;
                _oldDetailHeight = DetailRowHeight.Value;
            }
            DoHandleExpandCollapse();
        }

        private void MasterGrid_Loaded(object sender, RoutedEventArgs e)
        {
            if (MasterGrid.ItemsSource == null)
                MasterGrid.ItemsSource = MasterItems;
        }

        private void DetailGrid_Loaded(object sender, RoutedEventArgs e)
        {
            if (DetailGrid.ItemsSource == null)
                DetailGrid.ItemsSource = DetailItems;
        }

        private void MainContainer_Loaded(object sender, RoutedEventArgs e)
        {
            MainContainer.DataContext = this;
        }

        #endregion // Events

        #region Helpers

        private void DoHandleExpandCollapse()
        {
            if (MasterExpander == null || DetailExpander == null)
                return;

            SplitterRowHeight = new GridLength(0);
            if (MasterExpander.IsExpanded &amp;&amp; DetailExpander.IsExpanded)
            {
                MasterRowHeight = new GridLength(_oldMasterHeight, GridUnitType.Star);
                DetailRowHeight = new GridLength(_oldDetailHeight, GridUnitType.Star);
                SplitterRowHeight = new GridLength(20);
                return;
            }

            if (MasterExpander.IsExpanded)
                MasterRowHeight = new GridLength(1, GridUnitType.Star);
            else
                MasterRowHeight = new GridLength(1, GridUnitType.Auto);

            if (DetailExpander.IsExpanded)
                DetailRowHeight = new GridLength(1, GridUnitType.Star);
            else
                DetailRowHeight = new GridLength(1, GridUnitType.Auto);
        }

        #endregion // Helpers

    }

    public class DummyItem
    {
        public DummyItem(string name, string id)
        {
            this.Name = name;
            this.ID = id;
        }
        public string Name
        {
            get;
            set;
        }
        public string ID
        {
            get;
            set;
        }
    }
}
</pre>
<p>Al final asi es como luce la solucion:</p>
<p><a href="http://yohan.jasdid.com/wp-content/uploads/2010/06/expander-splitter.jpg"><img class="alignnone size-medium wp-image-850" title="expander-splitter" src="http://yohan.jasdid.com/wp-content/uploads/2010/06/expander-splitter-450x299.jpg" alt="" width="450" height="299" /></a></p>
<p>La solucion ejemplo esta hecha con Visual Studio 2010 y el codigo fuente lo puedes bajar del siguiente link <a title="ExpanderAndSplitter.rar" href="http://yohan.jasdid.com/wp-content/uploads/2010/06/ExpanderAndSplitter.rar">ExpanderAndSplitter</a>.</p>
<p>Enjoy! <img src='http://yohan.jasdid.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Yohan Rodriguez</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://yohan.jasdid.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://yohan.jasdid.com/2010/06/wpf-expander-y-splitter-trabajando-juntos-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OutOfMemory exception</title>
		<link>http://yohan.jasdid.com/2009/10/outofmemory-exception/</link>
		<comments>http://yohan.jasdid.com/2009/10/outofmemory-exception/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 19:37:28 +0000</pubDate>
		<dc:creator>yohan.jasdid</dc:creator>
				<category><![CDATA[Bits]]></category>

		<guid isPermaLink="false">http://www.codeandchess.com/?p=115</guid>
		<description><![CDATA[Bueno, pues ultimamente he estado perdiendo mucho tiempo en mi trabajo por este tipo de errores, que mas que error pues creo que es un poco obvio que necesito mas memoria en mi PC, Bueno tal vez se deba a que tengo siempre abierto 3 o 4 instancias del Visual Studio 2008, itunes, Google Chrome [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://farm3.static.flickr.com/2568/4005781038_1f13ff16a8.jpg" alt="Out Of Memory by you." width="435" height="213" /> Bueno, pues ultimamente he estado perdiendo mucho tiempo en mi trabajo por este tipo de errores, que mas que error pues creo que es un poco obvio que necesito mas memoria en mi PC,</p>
<p>Bueno tal vez se deba a que tengo siempre abierto 3 o 4 instancias del Visual Studio 2008, itunes, Google Chrome (unas 5 instancias), Messenger, Skype, Sql Server 2005, Blend 3, Outlook, y el antivirus chafa que me pusieron que se pone a escanear la computadora como burro sin mecate!</p>
<p>Pues yo la verdad considero que lo que regularmente tengo abierto al mismo tiempo cualquier programador podria usar esa misma cantidad de programas al mismo tiempo si no es que mucho mas pero bueno, por lo visto estoy corriendo vista y casi cada vez que compilo sale este error molesto el cual desaparece si cierro y vuelvo a abrir el proyecto en VS2008</p>
<p>Saludos!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://yohan.jasdid.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://yohan.jasdid.com/2009/10/outofmemory-exception/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Primeros pasos con WPF,</title>
		<link>http://yohan.jasdid.com/2008/11/primeros-pasos-con-wpf/</link>
		<comments>http://yohan.jasdid.com/2008/11/primeros-pasos-con-wpf/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 03:48:42 +0000</pubDate>
		<dc:creator>yohan.jasdid</dc:creator>
				<category><![CDATA[Bits]]></category>
		<category><![CDATA[first steps]]></category>
		<category><![CDATA[Science & Technology]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[wpf]]></category>

		<guid isPermaLink="false">http://yohan.jasdid.com/?p=149</guid>
		<description><![CDATA[Hoy sabado me di un tiempo para investigar un poco sobre WPF ya que me acaban de asignar a un proyecto bastannnnnte interesante y estare utilizando tecnologias mas nuevas como el framework 3.0 y 3.5 por lo que me di un espacio para investigar un poco, Al final del dia (bueno todavia no se acaba [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy sabado me di un tiempo para investigar un poco sobre WPF ya que me acaban de asignar a un proyecto bastannnnnte interesante y estare utilizando tecnologias mas nuevas como el framework 3.0 y 3.5 por lo que me di un espacio para investigar un poco,</p>
<p>Al final del dia (bueno todavia no se acaba jejej) he logrado comprender en un buen porcentaje el manejo de XAML asi como la creacion del mismo desde dentro de C# y la flexibilidad que esto significa, proximamente espero darme otro tiempo para hacer unas pruebas de estos mismos XAML&#8217;s con Silverlight y colgarlos a la web esperemos que tenga un tiempesillo jej..</p>
<p style="text-align: left;"><a href="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf1.jpg"><img class="alignnone size-medium wp-image-145" title="wpf1" src="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf1-450x441.jpg" alt="" width="450" height="441" /></a></p>
<p style="text-align: left;">No podia faltar el clasico hello WPF <img src='http://yohan.jasdid.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: right;"> </p>
<p style="text-align: right;"><a href="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf2.jpg"><img class="alignnone size-medium wp-image-146" title="wpf2" src="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf2-450x276.jpg" alt="" width="450" height="276" /></a></p>
<p style="text-align: left;">Cabe mencionar que estos ejemplos los lei en un buen libro que me encontre por ahi llamado windows presentation foundation unleashed</p>
<p style="text-align: left;"><a href="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf4.jpg"><img class="alignnone size-medium wp-image-147" title="wpf4" src="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf4-450x251.jpg" alt="" width="450" height="251" /></a></p>
<p style="text-align: left;">Y el ejemplo que alimenta a mi ego jejej la verdad que estos combos enriquecidos y en general cualquier tipo de control son tremendamente flexibles!</p>
<p style="text-align: right;"><a href="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf5.jpg"><img class="alignnone size-medium wp-image-148" title="wpf5" src="http://yohan.jasdid.com/wp-content/uploads/2008/11/wpf5-450x309.jpg" alt="" width="450" height="309" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://yohan.jasdid.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://yohan.jasdid.com/2008/11/primeros-pasos-con-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
