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 scroll position is reset after switching back to the application via Alt+Tab #18153

Open
tms320 opened this issue Feb 9, 2025 · 0 comments
Labels

Comments

@tms320
Copy link

tms320 commented Feb 9, 2025

Describe the bug

I use DataGrid as follows:

<TabControl ItemsSource="{Binding Nodes}">
  <TabControl.ContentTemplate>
    <DataTemplate>
      <Grid ColumnDefinitions="Auto,*">
        <DataGrid Grid.Column="0" ItemsSource="{Binding Objects}" IsReadOnly="True">
          <DataGrid.Columns>
            <DataGridTextColumn Header="Address" IsReadOnly="True" Binding="{Binding Address}"/>
            <DataGridTextColumn Header="Value" IsReadOnly="True" Binding="{Binding Value}"/>
          </DataGrid.Columns>
        </DataGrid>
      </Grid>
    </DataTemplate>
  </TabControl.ContentTemplate>
</TabControl>

If I switch to other Windows application and then switch back to my app via Alt+Tab, the scroll position of DataGrid is reset.
Why? How can I preserve scroll position?
PS: If I minimize my app and then restore it or use task bar buttons to switch between apps, the scroll position isn't reset.

To Reproduce

  1. Scroll DataGrid to some nonzero position.
  2. Switch to other Windows application.
  3. Switch back to Avalonia application via Alt+Tab (this is a key condition).
  4. The scroll position of DataGrid is reset to zero.

Expected behavior

The scroll position remains unchanged.

Avalonia version

11.2.3

OS

Windows

Additional context

No response

@tms320 tms320 added the bug label Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant