I am trying to change the margin around a set of programmatically generated listboxes using the following code:
newListBox.Margin = new Thickness(0, 0, 0, 0);
However this gives me the error:
the type or namespace Thickness could not be found
I tried adding using System.Windows namespace but I still get the same error. Can anyone help please?
System.Windows.Thickness is part of the Presentation Framework. If you arent using WPF or Silverlight try referencing PresentationFramework.dll to get access to the Thickness structure.
But I'm afraid that in this case your ListBox.Margin won't accept an object of type Thickness. Try System.Windows.Forms.Padding if you're using WinForms.
I believe you're looking for Padding. See Control.Margin
newListBox.Margin = new Padding(0, 0, 0, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With