Simeon Wislang
Simeon Wislang

Reputation: 461

C# WPF DataGrid outside Window

I am building an application that requires a DataGrid that can be hidden. I have tried wrapping it in an Expander but it isn't exactly ideal. Ideally what I would like is the ability to have the DataGrid "floating" outside the main window without affecting the other controls and just having a button to hide and show it when needed.

Is this at all possible?

Thanks for your time.

Upvotes: 0

Views: 595

Answers (3)

Nir
Nir

Reputation: 29594

<ToggleButton Name="ShowHideGrid" Content="Show/Hide Grid"/>
<Popup IsOpen="{Binding ElementName=ShowHideGrid, Path=IsChecked}">
    <!-- Grid goes here -->
</Popup>

Upvotes: 0

RandomEngy
RandomEngy

Reputation: 15413

You could put it in a Popup and change its IsOpen state to hide or show it. Though keep in mind that the Popup won't move around with the window.

Upvotes: 1

A9S6
A9S6

Reputation: 6675

You will have to put it on a form to make it float. The new form can be a child of the main form opened as non-modal.

Upvotes: 1

Related Questions