Skip to content

Commit

Permalink
Add a message when no item is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeeynamo committed Nov 16, 2019
1 parent 5255347 commit 7ccb547
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 13 additions & 0 deletions OpenKh.Tools.Kh2SystemEditor/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using OpenKh.Kh2;
using OpenKh.Kh2.System;
using OpenKh.Tools.Common.Models;
Expand Down Expand Up @@ -95,6 +96,10 @@ private ItemViewModel(IMessageProvider messageProvider, IEnumerable<Item.Entry>
}

public string EntryName => entryName;

public Visibility IsItemEditingVisible => IsItemSelected ? Visibility.Visible : Visibility.Collapsed;
public Visibility IsItemEditMessageVisible => !IsItemSelected ? Visibility.Visible : Visibility.Collapsed;


public string SearchTerm
{
Expand All @@ -118,6 +123,14 @@ public Stream CreateStream()
return stream;
}

protected override void OnSelectedItem(Entry item)
{
base.OnSelectedItem(item);

OnPropertyChanged(nameof(IsItemEditingVisible));
OnPropertyChanged(nameof(IsItemEditMessageVisible));
}

private void PerformFiltering()
{
if (string.IsNullOrWhiteSpace(SearchTerm))
Expand Down
9 changes: 5 additions & 4 deletions OpenKh.Tools.Kh2SystemEditor/Views/ItemView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@
</Grid>
</Grid>

<!--<StackPanel
<StackPanel
Grid.Column="2"
Visibility="{Binding IsItemEditMessageVisible}">
Margin="5 0 5 0"
Visibility="{Binding IsItemEditMessageVisible, FallbackValue=Collapsed}">
<TextBlock
Text="Please select an item to modify"/>
</StackPanel>-->
</StackPanel>

<ScrollViewer
Grid.Column="2"
Margin="5"
Margin="5 0 5 0"
VerticalScrollBarVisibility="Auto"
Visibility="{Binding IsItemEditingVisible}">
<controls:TwoColumnsPanel RowSpacing="3" DataContext="{Binding SelectedItem}">
Expand Down

0 comments on commit 7ccb547

Please sign in to comment.