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.Thicknessis part of the Presentation Framework. If you arent using WPF or Silverlight try referencing PresentationFramework.dll to get access to theThicknessstructure.But I’m afraid that in this case your
ListBox.Marginwon’t accept an object of typeThickness. TrySystem.Windows.Forms.Paddingif you’re using WinForms.