All Questions
Tagged with visibility c#
297
questions
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" ...
32
votes
8
answers
30k
views
Accessing a Private Constructor from Outside the Class in C#
If I define a class with a private default constructor and a public constructor that has parameters, how can I access the private constructor?
public class Bob
{
public String Surname { get; set; }
...
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>
<...
30
votes
3
answers
28k
views
MultiDataTrigger with OR instead of AND
I am trying to set multiple DataTriggers on my Button. I did some research and found that MultiDataTrigger allows you to do this. I want the Visibility property of my Button to be set to false if the ...
24
votes
17
answers
31k
views
C#/.NET - WinForms - Instantiate a Form without showing it
I am changing the Visibility of a Form to false during the load event AND the form still shows itself. What is the right event to tie this.Visible = false; to? I'd like to instantiate the Form1 ...
24
votes
4
answers
28k
views
Disable or grey out a node in the TreeNode Editor
How do I disable a specific node so the user can not select it. Hiding it for the user is also valid.
I tried the Visible property but that hides the entire tree (all nodes). I only want a few of the ...
22
votes
2
answers
12k
views
What does a public constructor on an internal class mean [duplicate]
I've seen some C# code that declares a class with an internal modifier, with a public constructor:
internal class SomeClass
{
public SomeClass()
{
}
}
What is the point of having a ...
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=...
17
votes
7
answers
7k
views
Visibility of nested class constructor
Is there a way to limit the instantiation of the nested class in C#? I want to prevent nested class being instantiated from any other class except the nesting class, but to allow full access to the ...
16
votes
5
answers
60k
views
How to hide textboxes, labels and buttons C# WPF
I would like to hide several textboxes, a label and a button as soon as a button is clicked... however, for some reason, my code doesn't seem to cause this effect. Nothing appears to happen. I'm using ...
13
votes
3
answers
8k
views
How to check if a scroll is currently visible in WPF DataGrid?
How to check if a scroll (vertical or horizontal) is currently shown in WPF DataGrid? HorizontalScrollBarVisibility and VerticalScrollBarVisibility are used to set the behaviour and they are set to ...
13
votes
9
answers
16k
views
sometimes I want to hide buttons in a DataGridViewButtonColumn
I have a DataGridView which was the subject of a previous question (link). But sometimes the Button is null. This is fine. But if it is null, is there any way I can optionally remove/add (show/hide?) ...
13
votes
3
answers
11k
views
How to get the private fields of class and its parent class(es) by reflection?
I have the class B and its parent class A, both in namespace Domain.
Class A, has the private field a;
Class B, has the private field b;
Then I have a Reflection Util in namespace Reflect.
If I use ...
12
votes
4
answers
9k
views
How can I determine programmatically whether the Windows taskbar is hidden or not?
I need to know whether the Windows taskbar is hidden or not. I believe there is no .NET method to do this, and also I have come across a lot of "how to hide and show the taskbar" samples, but I haven'...
12
votes
3
answers
9k
views
How do I determine visibility of a control?
I have a TabControl that contains several tabs. Each tab has one UserControl on it. I would like to check the visibility of a control x on UserControl A from UserControl B. I figured that doing x....