Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

Tagged with
99 votes
4 answers
66k views

Binding Visibility for DataGridColumn in WPF

How can I hide a column in a WPF DataGrid through a Binding? This is what I did: <DataGridTextColumn Header="Column header" Binding="{Binding ColumnValue}" ...
ygoe's user avatar
  • 19.8k
72 votes
4 answers
60k views

In WPF, how can I determine whether a control is visible to the user?

I'm displaying a very big tree with a lot of items in it. Each of these items shows information to the user through its associated UserControl control, and this information has to be updated every 250 ...
Trap's user avatar
  • 12.3k
171 votes
18 answers
125k views

How do I invert BooleanToVisibilityConverter?

I'm using a BooleanToVisibilityConverter in WPF to bind the Visibility property of a control to a Boolean. This works fine, but I'd like one of the controls to hide if the boolean is true, and show if ...
user avatar
192 votes
12 answers
197k views

DataTrigger where value is NOT null?

I know that I can make a setter that checks to see if a value is NULL and do something. Example: <TextBlock> <TextBlock.Style> <Style> <Style.Triggers> <...
Timothy Khouri's user avatar
327 votes
4 answers
164k views

Difference between Visibility.Collapsed and Visibility.Hidden

What are differences between Visibility.Collapsed and Visibility.Hidden in WPF?
Sauron's user avatar
  • 16.8k
19 votes
4 answers
13k views

MVVM pattern violation: MediaElement.Play()

I understand that ViewModel shouldn't have any knowledge of View, but how can I call MediaElement.Play() method from ViewModel, other than having a reference to View (or directly to MediaElement) in ...
italianogrosso's user avatar
34 votes
6 answers
121k views

Bind visibility property to a variable

I have a Border with Label inside a Window, <Border x:Name="Border1" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="21" Margin="229,164,0,0" VerticalAlignment="Top" ...
7zawel's user avatar
  • 383
32 votes
4 answers
33k views

WPF Tooltip Visibility

How can I ensure that a button's Tooltip is only visible when the button is disabled? What can I bind the tooltip's visibility to?
David Ward's user avatar
  • 3,799
13 votes
2 answers
32k views

WPF Visibility of a UI element based on combo selection

Trying to show a label only when a certain item in a combo is selected. Code should pretty much explain it. <ComboBox Name="comboMyCombo"> <ComboBoxItem>Don't show the label&...
tim's user avatar
  • 155
17 votes
2 answers
7k views

MVVM - hiding a control when bound property is not present

I was wondering if it is possible to hide a control on a view if the property to which the control is bound does not exist in the view model. For example, if I have the following: <CheckBox ...
Joe K's user avatar
  • 409
31 votes
5 answers
63k views

Dynamically toggle visibility of WPF grid column from C# code

My problem is: I can't find out how to toggle the visibility of my WPF grid column. Assume following XAML markup: <Grid x:Name="myGrid"> <Grid.RowDefinitions> <...
sebi's user avatar
  • 431
25 votes
3 answers
23k views

WPF - hiding listbox items

I have a listbox where the itemtemplate is using a style. The styles specifies a border with a datatrigger setting the visibility of the border to collapsed depending on a property. This works fine ...
c95mbq's user avatar
  • 584
19 votes
7 answers
40k views

C#/WPF: Make a GridViewColumn Visible=false?

Is there an option to hide a GridViewColumn somehow like this: <ListView.View> <GridView> <GridViewColumn Header="Test" IsVisible="{Binding Path=...
Joseph jun. Melettukunnel's user avatar
18 votes
5 answers
25k views

WPF: Binding Visibility by string contents

Ok, so here is my XAML: <TextBlock Text="{Binding Path=InstanceName}"></TextBlock> If InstanceName is null or an empty string, I want Visibility="Collapsed". Otherwise I want Visibility="...
Jonathan Allen's user avatar
15 votes
2 answers
45k views

Get datagrid rows

How can I get the list of rows in the DataGrid? Not the bound items, but the DataGridRows list. I need to control the visibility of these rows and it's only possible to control it as a DataGridRow ...
user196625's user avatar

15 30 50 per page