Skip to main content

All Questions

Tagged with
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
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 ...
BuddyJoe's user avatar
  • 70.7k
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; } ...
AndrewJacksonZA's user avatar
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
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 ...
lysergic-acid's user avatar
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
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?) ...
Mr Heelis's user avatar
  • 2,488
11 votes
5 answers
3k views

Does Interlocked provide visibility in all threads?

Suppose I have a variable "counter", and there are several threads accessing and setting the value of "counter" by using Interlocked, i.e.: int value = Interlocked.Increment(ref counter); and int ...
Chaowlert Chaisrichalermpol's user avatar
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 ...
mr-euro's user avatar
  • 2,752
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 ...
Ralph's user avatar
  • 120k
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 ...
brain_pusher's user avatar
  • 1,527
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'...
user246392's user avatar
  • 2,863
11 votes
5 answers
13k views

Protection level of a struct field within a class

I get a "'A.Test.That.Fails' is inaccessible due to its protection level" error on the following code snippet and I fail to understand the reason. namespace A { class Test { ...
Julien Guertault's user avatar
9 votes
3 answers
5k views

Overriding an internal abstract method in another assembly

Im currently working on a c# project that uses another .net library. This library does (amongst other things) parse a sequence into a tree. All items are of some type that inherits from the abstract ...
Philip Daubmeier's user avatar
5 votes
2 answers
2k views

Why is the Visible property not correctly updated in a UserControl?

Sometimes my UserControl's Visible property does not get updated correctly. It happens at my app's boot time, in OnFontChanged, fired from inside InitializeComponent, probably because some other stuff ...
Gabriel's user avatar
  • 3,017

15 30 50 per page