Skip to content

Commit

Permalink
Fixed some visual differences in Views
Browse files Browse the repository at this point in the history
  • Loading branch information
Firewolf1337 committed Mar 12, 2024
1 parent 81f8bf1 commit 3a4893c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
28 changes: 10 additions & 18 deletions RCRPlanner/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -593,15 +593,6 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Race times" IsReadOnly="True" SortMemberPath="RaceTimes" CanUserSort="True" HeaderStyle="{StaticResource DataGridHeaderCenter}">
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource DefaultDataGridCell50hStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding RaceTimes}" Value="Set times">
<Setter Property="ToolTip" Value="{Binding SessionTimes}" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTemplateColumn.CellStyle>
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<TextBlock Text="{Binding RaceTimes}" HorizontalAlignment="Center"/>
Expand All @@ -619,11 +610,11 @@
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DockPanel Background="{StaticResource DefaultBackgroundBrush}" HorizontalAlignment="Stretch">
<DataGrid x:Name="gridSeriesTrack" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" Style="{StaticResource SubDataGridStyle}"
<DataGrid x:Name="gridSeriesTrack" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" Height="390" Style="{StaticResource SubDataGridStyle}"
AutoGenerateColumns="False"
SelectionChanged="dataGrid_SelectionChanged"
SelectionMode="Extended" IsReadOnly="True" ScrollViewer.CanContentScroll="False" ItemsSource="{Binding Tracks}"
PreviewMouseWheel="DataGrid_PreviewMouseWheel">
SelectionMode="Extended" IsReadOnly="True" ItemsSource="{Binding Tracks}"
Loaded="ScrollWeekIntoView">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRowStyle}">
<Style.Triggers>
Expand Down Expand Up @@ -1007,12 +998,13 @@
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DockPanel Background="{StaticResource DefaultBackgroundBrush}">
<DataGrid HorizontalAlignment="Center" x:Name="gridTracksinSerie" Grid.Row="0" Height="390" Grid.Column="0" Style="{StaticResource SubDataGridStyle}"
AutoGenerateColumns="False" MinColumnWidth="50" GridLinesVisibility="None"
SelectionMode="Extended" IsReadOnly="True" ScrollViewer.CanContentScroll="False" ItemsSource="{Binding Tracks}"
SelectionChanged="dataGrid_SelectionChanged"
VerticalAlignment="Top">
<DockPanel Background="{StaticResource DefaultBackgroundBrush}" HorizontalAlignment="Stretch">
<DataGrid x:Name="gridTracksinSerie" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" Height="390" Style="{StaticResource SubDataGridStyle}"
AutoGenerateColumns="False" MinColumnWidth="50"
SelectionChanged="dataGrid_SelectionChanged"
SelectionMode="Extended" IsReadOnly="True" ItemsSource="{Binding Tracks}"
Loaded="ScrollWeekIntoView"
>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRowStyle}">
<Style.Triggers>
Expand Down
27 changes: 22 additions & 5 deletions RCRPlanner/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2176,6 +2176,9 @@ private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs
case "gridSeries":
scrollDataGridIntoView(sender);
break;
case "gridRaces":
scrollDataGridIntoView(sender);
break;
case "gridTracks":
tbDetail3.Text = ((dgObjects.tracksDataGrid)((DataGrid)sender).SelectedItem).Corners.ToString();
lblDetails3.Content = "Corners:";
Expand Down Expand Up @@ -2219,10 +2222,6 @@ private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs
catch { Trackimage.Source = null;}
}
break;
case "gridRaces":
scrollDataGridIntoView(sender);
break;

}
}
}
Expand Down Expand Up @@ -2387,6 +2386,7 @@ private void btnLoadSeries_Click(object sender, RoutedEventArgs e)

private void btnLoadRaces_Click(object sender, RoutedEventArgs e)
{
generateRaceView();
activeGrid = "gridRaces";
gridSeasonOverview.Visibility = Visibility.Hidden;
scrollSeasonOverview.Visibility = Visibility.Hidden;
Expand All @@ -2412,7 +2412,7 @@ private void btnLoadRaces_Click(object sender, RoutedEventArgs e)
lbMenu2.Content = "Alarm offset:";

stackPanelMenuClose_MouseDown(null, null);
generateRaceView();

switchMainGridVisibility(new List<System.Windows.Controls.DataGrid> { gridRaces }, false);
}
private void btnPartStats_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -3424,5 +3424,22 @@ private void LoginClose_MouseDown(object sender, MouseButtonEventArgs e)
}
move_grid(gridLogin, "bottom", position, moveAnimationDuration);
}

private void ScrollWeekIntoView(object sender, RoutedEventArgs e)
{
DataGrid dataGrid = new DataGrid();
dataGrid = sender as DataGrid;
foreach(var row in dataGrid.Items)
{
if (((RCRPlanner.dgObjects.tracksDataGrid)row).WeekActive == true)
{
dataGrid.ScrollIntoView(dataGrid.Items[dataGrid.Items.Count - 1]);
dataGrid.UpdateLayout();
dataGrid.ScrollIntoView(row);
dataGrid.UpdateLayout();
break;
}
}
}
}
}

0 comments on commit 3a4893c

Please sign in to comment.