Several fixes in views and view models.

This commit is contained in:
Daniel Kraus 2015-08-30 20:54:08 +02:00
parent dca55f6b57
commit d86f910208
6 changed files with 16 additions and 3 deletions

View File

@ -273,6 +273,10 @@ namespace zaaReloaded2.ViewModels
{
_repository = repository;
BuildSettingsList();
if (SettingsList.Count > 0)
{
SettingsList.First().IsSelected = true;
}
RequestCloseView += (sender, args) =>
{
_repository.Store();

View File

@ -222,6 +222,10 @@ namespace zaaReloaded2.ViewModels
vm.PropertyChanged += ElementViewModel_PropertyChanged;
Elements.Add(vm);
}
if (Elements.Count > 0)
{
Elements.First().IsSelected = true;
}
}
#endregion

View File

@ -25,6 +25,7 @@
WindowStyle="ToolWindow" Topmost="True"
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
Title="Neues Element auswählen"
FocusManager.FocusedElement="{Binding ElementName=treeview}"
>
<Window.Resources>
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
@ -35,7 +36,7 @@
<Button Content="OK" Command="{Binding ChooseElementCommand}" IsDefault="True" Margin="0 0 5 0" />
<Button Content="Abbrechen" Command="{Binding CloseViewCommand}" IsCancel="True" Margin="5 0 0 0" />
</UniformGrid>
<TreeView ItemsSource="{Binding Categories}">
<TreeView ItemsSource="{Binding Categories}" x:Name="treeview">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True" />

View File

@ -26,6 +26,7 @@
Width="280" Height="180" MinWidth="280" MinHeight="180"
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
Title="Element bearbeiten"
FocusManager.FocusedElement="{Binding ElementName=ContentTextBox}"
>
<Window.Resources>
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />

View File

@ -28,6 +28,7 @@
ResizeMode="CanResizeWithGrip" ShowInTaskbar="False"
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
Title="Stil auswählen"
FocusManager.FocusedElement="{Binding ElementName=settingsList}"
>
<Window.Resources>
<ResourceDictionary Source="/zaaReloaded2;component/style.xaml" />

View File

@ -28,6 +28,7 @@
WindowStyle="ToolWindow" Topmost="True"
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
Title="Stil bearbeiten"
FocusManager.FocusedElement="{Binding ElementName=NameTextBox}"
>
<Window.Resources>
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
@ -50,7 +51,8 @@
<DockPanel DockPanel.Dock="Top" IsEnabled="{Binding IsNameEnabled}">
<Label DockPanel.Dock="Left" Content="Name:" Target="{Binding ElementName=NameTextBox}"
Margin="0 0 10 0"/>
<TextBox Text="{Binding Name}" x:Name="NameTextBox" HorizontalAlignment="Stretch" />
<TextBox Text="{Binding Name,UpdateSourceTrigger=PropertyChanged}"
x:Name="NameTextBox" HorizontalAlignment="Stretch" />
</DockPanel>
<DockPanel DockPanel.Dock="Top">
<Label DockPanel.Dock="Left" Content="Referenzwerte anzeigen:" Margin="0 0 10 0"
@ -107,7 +109,7 @@
</Button>
</UniformGrid>
</StackPanel>
<TreeView ItemsSource="{Binding Elements}">
<TreeView ItemsSource="{Binding Elements}" x:Name="treeview">
<TreeView.InputBindings>
<MouseBinding Gesture="MiddleClick" Command="{Binding EditElementCommand}" />
<KeyBinding Key="Space" Command="{Binding EditElementCommand}" />