Skip to content

Commit

Permalink
File Load Fix, UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
roveldman committed Aug 20, 2020
1 parent c1c12f0 commit 4d6101d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions QuizCards/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Path=GameModel.CurrentItem.Question.Question, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="10" />
<ListBox Grid.Row="1" ItemsSource="{Binding Path=GameModel.CurrentItem.Question.Choices, UpdateSourceTrigger=PropertyChanged}" SelectedIndex="{Binding Path=SelectedAnswer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10" />
<ListBox Grid.Row="1" ItemsSource="{Binding Path=GameModel.CurrentItem.Question.Choices, UpdateSourceTrigger=PropertyChanged}" SelectedIndex="{Binding Path=SelectedAnswer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10">
<ListBox.Style>
<Style TargetType="ListBox">
<Setter Property="IsHitTestVisible" Value="True"/>
<Style.Triggers>
<DataTrigger Binding="{Binding GameModel.State}" Value="Feedback">
<Setter Property="IsHitTestVisible" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.Style>
</ListBox>

<StackPanel Grid.Row="2" Margin="10" Orientation="Horizontal">
<StackPanel.Style>
Expand Down Expand Up @@ -117,7 +128,7 @@
</Button>
</StackPanel>

<StackPanel Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<StackPanel Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<Button Command="{Binding AdvanceCommand}" Content="Next" Padding="10">
<Button.Style>
<Style TargetType="Button">
Expand Down
2 changes: 1 addition & 1 deletion QuizCards/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public MainWindowViewModel()
private void OpenNew(object obj)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
// openFileDialog.InitialDirectory = "./Quizzes/";
openFileDialog.ShowDialog();
try
{
GameModel = new GameModel(openFileDialog.FileName);
NotifyPropertyChanged("GameModel");
}
catch (Exception e)
{
Expand Down

0 comments on commit 4d6101d

Please sign in to comment.