Add IsExpanded property to ElementViewModel.

This commit is contained in:
Daniel Kraus 2015-08-12 22:29:31 +02:00
parent 2bb0452a87
commit a9d0e8ee7e
3 changed files with 14 additions and 2 deletions

View File

@ -41,6 +41,16 @@ namespace zaaReloaded2.ViewModels
public abstract string ToolTip { get; }
public bool IsExpanded
{
get { return _isExpanded; }
set
{
_isExpanded = value;
OnPropertyChanged("IsExpanded");
}
}
#endregion
#region Constructors
@ -77,7 +87,7 @@ namespace zaaReloaded2.ViewModels
#region Fields
string _displayString;
bool _isExpanded;
#endregion
}

View File

@ -503,6 +503,7 @@ namespace zaaReloaded2.ViewModels
ControlElementViewModel controlElementAbove =
Elements[index - 1] as ControlElementViewModel;
Elements.RemoveAt(index);
controlElementAbove.IsExpanded = true;
controlElementAbove.AddChildElement(
lastSelectedElement as FormatElementViewModel);
FormatElementBase model = lastSelectedElement.RevealModelObject() as FormatElementBase;
@ -599,6 +600,7 @@ namespace zaaReloaded2.ViewModels
ControlElementViewModel controlElementBelow =
Elements[index + 1] as ControlElementViewModel;
Elements.RemoveAt(index);
controlElementBelow.IsExpanded = true;
controlElementBelow.Elements.Insert(
0,
lastSelectedElement as FormatElementViewModel);

View File

@ -95,7 +95,7 @@
<TreeView ItemsSource="{Binding Elements}">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<!--<Setter Property="IsExpanded" Value="True" />-->
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
</Style>