Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGrid with groupstyle shows errors #3236

Closed
raytangRT opened this issue May 3, 2018 · 2 comments · Fixed by #3805
Closed

DataGrid with groupstyle shows errors #3236

raytangRT opened this issue May 3, 2018 · 2 comments · Fixed by #3805
Assignees
Labels
Milestone

Comments

@raytangRT
Copy link

raytangRT commented May 3, 2018

What steps will reproduce this issue?

DataGrid with groupstyle shows the following errors

Related Issue #2356

Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''. BindingExpression:Path=SelectionUnit; DataItem=null; target element is 'DataGridRow' (Name=''); target property is 'SelectionUnit' (type 'DataGridSelectionUnit')
Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''. BindingExpression:Path=AreRowDetailsFrozen; DataItem=null; target element is 'DataGridDetailsPresenter' (Name=''); target property is 'SelectiveScrollingOrientation' (type 'SelectiveScrollingOrientation')
Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''. BindingExpression:Path=HeadersVisibility; DataItem=null; target element is 'DataGridRowHeader' (Name=''); target property is 'Visibility' (type 'Visibility')

Expected outcome

No error shown

Repo

repo

Environment

  • MahApps.Metro v1.6.1
  • Windows OS Windows 7
  • Visual Studio 2013
  • .NET Framework 4.5
@punker76 punker76 self-assigned this May 3, 2018
@punker76 punker76 added the Bug label May 3, 2018
@lipchev
Copy link
Contributor

lipchev commented Aug 22, 2019

Issue is still here in version 1.6.5. A workaround that I use is to set the selections manually:

            <DataGrid.RowStyle>
                <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource AzureDataGridRow}">
                    <Setter Property="mah:DataGridRowHelper.SelectionUnit"
                            Value="{x:Static DataGridSelectionUnit.FullRow}" />
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.CellStyle>
                <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource AzureDataGridCell}">
                    <Setter Property="mah:DataGridCellHelper.SelectionUnit"
                            Value="{x:Static DataGridSelectionUnit.FullRow}" />
                </Style>
            </DataGrid.CellStyle>

@punker76 punker76 added this to the 2.0.0 milestone May 21, 2020
punker76 added a commit that referenced this issue May 22, 2020
- New style MahApps.Styles.ToggleButton.ExpanderHeader.Down.DataGrid.Group.Container
- New style MahApps.Styles.GroupItem.DataGrid.Group.Container
- Fix "Cannot find source for binding with reference..." errors
punker76 added a commit that referenced this issue May 22, 2020
- MahApps.Styles.ToggleButton.ExpanderHeader.Down.DataGrid.GroupItem
- MahApps.Styles.GroupItem.DataGrid
@punker76
Copy link
Member

@raytangRT This is finally fixed now and will be available with v2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants