Note that there are some explanatory texts on larger screens.

plurals
  1. POAutosizing templated column in a ListView based Multicolumn treeview
    text
    copied!<p>I'm using the multicolumn treeview control which I found here <a href="http://www.codeproject.com/KB/WPF/wpf_treelistview_control.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/WPF/wpf_treelistview_control.aspx</a></p> <p>The first column in this control which consists of a simulated tree view control needs to be autosized when a node is expanded/collapsed.</p> <p>Any help?</p> <p>Sample XAML</p> <pre><code>&lt;UserControl x:Class="ListViewAsTreeView.XmlTree" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ListViewAsTreeView" xmlns:tree="clr-namespace:Aga.Controls.Tree;assembly=Aga.Controls"&gt; &lt;UserControl.Resources&gt; &lt;local:RegImageConverter x:Key="RegImageConverter"/&gt; &lt;local:ComboList x:Key="MyComboSource"/&gt; &lt;/UserControl.Resources&gt; &lt;StackPanel&gt; &lt;tree:TreeList Name="_tree" local:DragAndDrop.DropEnabled="true" MinHeight="40" IsSynchronizedWithCurrentItem="True"&gt; &lt;tree:TreeList.View&gt; &lt;GridView&gt; &lt;GridView.Columns&gt; &lt;GridViewColumn Header="Name"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;tree:RowExpander/&gt; &lt;Image Source="{Binding Converter={StaticResource RegImageConverter}}" Margin="0, 0, 5, 0"/&gt; &lt;TextBlock Text="{Binding Name}"&gt; &lt;/TextBlock&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Header="Type" Width="Auto" DisplayMemberBinding="{Binding Kind, UpdateSourceTrigger=PropertyChanged}"/&gt; &lt;GridViewColumn Header="Data" Width="Auto" DisplayMemberBinding="{Binding Data, UpdateSourceTrigger=PropertyChanged}"/&gt; &lt;GridViewColumn Header="ComboSample" Width="Auto"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ComboBox Name="MyComboBox" ItemsSource="{StaticResource MyComboSource}" IsEditable="True" IsEnabled="True" Text="{Binding Name}"&gt; &lt;/ComboBox&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;/GridView.Columns&gt; &lt;/GridView&gt; &lt;/tree:TreeList.View&gt; &lt;/tree:TreeList&gt; &lt;ListBox local:DragAndDrop.DragEnabled="true"&gt; &lt;ListBoxItem&gt;Item 1&lt;/ListBoxItem&gt; &lt;ListBoxItem&gt;Item 2&lt;/ListBoxItem&gt; &lt;ListBoxItem&gt;Item 3&lt;/ListBoxItem&gt; &lt;/ListBox&gt; &lt;/StackPanel&gt; </code></pre> <p></p> <p>Thanks, Jithu</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload