Skip to content

Commit

Permalink
Additional fixes.
Browse files Browse the repository at this point in the history
Moved Projectgrid to seperate usercontrol
  • Loading branch information
StefanKert committed Mar 16, 2019
1 parent edfb460 commit c284def
Show file tree
Hide file tree
Showing 13 changed files with 516 additions and 428 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
public interface IBuildProgressViewModel
{
bool ActionProgressIsPaused { get; set; }
bool ActionProgressIsVisible { get; set; }
int CurrentQueuePosOfBuildingProject { get; }

void OnBuildBegin(int projectsCount);
Expand Down
7 changes: 7 additions & 0 deletions src/BuildVision.UI/BuildVision.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Components\ProjectGrid.xaml.cs">
<DependentUpon>ProjectGrid.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\BuildVisionProgressBar.xaml.cs">
<DependentUpon>BuildVisionProgressBar.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -228,6 +231,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Components\ProjectGrid.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Components\SpinnerControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
303 changes: 7 additions & 296 deletions src/BuildVision.UI/Components/ControlView.xaml

Large diffs are not rendered by default.

81 changes: 1 addition & 80 deletions src/BuildVision.UI/Components/ControlView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,11 @@ public ControlView()
//Grid.TargetUpdated += GridOnTargetUpdated;
}

private void GridOnTargetUpdated(object sender, DataTransferEventArgs e)
{
if (e.Property.Name == "ItemsSource")
RefreshSortDirectionInGrid();
}

private void RefreshSortDirectionInGrid()
{
//DataGridColumn dataGridColumn = Grid.Columns.FirstOrDefault(col => col.GetBindedProperty() == _viewModel.GridSortDescription.Property);
//if (dataGridColumn != null)
// dataGridColumn.SortDirection = _viewModel.GridSortDescription.Order.ToSystem();
}

private void GridOnSorting(object sender, DataGridSortingEventArgs e)
{
if (_viewModel.GridSorting.CanExecute(e))
_viewModel.GridSorting.Execute(e);
}

private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
Debug.Assert(DataContext != null);

_viewModel = (BuildVisionPaneViewModel)DataContext;
//_viewModel.SetGridColumnsRef(Grid.Columns);
_viewModel = (BuildVisionPaneViewModel) DataContext;
_viewModel.PropertyChanged += ViewModelOnPropertyChanged;
}

Expand All @@ -78,64 +58,5 @@ private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs
//}
}

private void DataGridExpanderOnExpanded(object sender, RoutedEventArgs e)
{
ExpanderIsExpandedConverter.SaveState(
(Expander)sender,
false,
_viewModel.ControlSettings.GridSettings.CollapsedGroups);
e.Handled = true;
}

private void DataGridExpanderOnCollapsed(object sender, RoutedEventArgs e)
{
ExpanderIsExpandedConverter.SaveState(
(Expander)sender,
true,
_viewModel.ControlSettings.GridSettings.CollapsedGroups);
e.Handled = true;
}

// Send scrolling to the DataGrid.
private void DataGridExpanderOnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
e.Handled = true;
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
{
RoutedEvent = MouseWheelEvent,
Source = sender
};

var parent = (UIElement)VisualTreeHelper.GetParent((DependencyObject)sender);
parent.RaiseEvent(eventArg);
}

private void DataGridRowDetailsOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// http://stackoverflow.com/questions/6279724/mousedoubleclick-events-dont-bubble/6326181#6326181)
if (e.ClickCount == 2)
e.Handled = true;
}

// Autofocus for RowDetails (without extra mouse click).
private void DataGridRowOnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var row = (DataGridRow)sender;
if (!row.IsSelected && e.Source is DataGridDetailsPresenter)
{
row.Focusable = true;
row.Focus();

// Gets the element with keyboard focus.
var elementWithFocus = Keyboard.FocusedElement as UIElement;

// Change keyboard focus.
if (elementWithFocus != null)
{
var request = new TraversalRequest(FocusNavigationDirection.Next);
elementWithFocus.MoveFocus(request);
}
}
}
}
}
Loading

0 comments on commit c284def

Please sign in to comment.