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; _repository = repository;
BuildSettingsList(); BuildSettingsList();
if (SettingsList.Count > 0)
{
SettingsList.First().IsSelected = true;
}
RequestCloseView += (sender, args) => RequestCloseView += (sender, args) =>
{ {
_repository.Store(); _repository.Store();

View File

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

View File

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

View File

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

View File

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

View File

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