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

View File

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

View File

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