I have a Listbox, that has a Checkbox as part of the item template.
In the click even of the Checkbox, I want to make sure that same list item is selected.
ListBoxItem lbi = ((ListBoxItem)listLayers.
ContainerFromElement((CheckBox)sender));
lbi.IsSelected = true;
The main issue that I'm having is that "Containe...
Hi All, I am struggling with an issue while loading an assembly up in a temporary AppDomain to read its GetUsedReferences property. Once I do that, I call AppDomain.Unload(tempDomain) and then I try to clean up my mess by deleting the files. That fails because the file is locked. I Unloaded the temporary domain though! Any thoughts o...
From what I saw on http://csharpindepth.com/Articles/Chapter6/IteratorBlockImplementation.aspx, and article by Jon Skeet, the c# specification itself says that. What would be the reason?
...
In ASP.Net Web Forms there are cases that I've come across that create order dependent code. As an obvious code smell I'm looking for solutions to solve this problem.
A pseudo-code example would be:
Calling Code :: Page.aspx
protected void Page_Load(...) {
var control = LoadControl("ControlX.ascx");
// Ugly since the control...
I am trying to push in a number of updates to a collection to which I have bound a list box. Since the list can get quite big, i am trying to turn off updates (sorting, etc) until I finished inserting all the new items.
I figured:
using (col.DeferRefesh())
{
.. add the items
}
but this raises an exception saying that I cannot add/...
I have these two pieces of code that could possibly be run at the same time on two different threads:
users = (from user in users
orderby user.IsLoggedIn descending ,
user.Username
select user).ToList();
and:
users=null;
The second piece of code will run on the main UI thread of the application. H...
For simplicity let's say I have two classes: a class called Car and a collection class called Tires. Tires is a nested class inside the Car class. I want to give my clients access to the collection - i.e. they should be able to iterate over it:
foreach( var tire in car.tires ) ...
and access each tire's properties. But I don't want...
In Winforms what is proper way to keep a user from changing the value of a DropDown?
I want to prompt the user to say that there are unsaved changes. If the user decides to not throw away these changes I want to cancel the combobox changing. Any ideas on how to do this?
I though I had seen a e.Cancel option before. But maybe not on Syst...
Background: I wanted to distribute a library to some other developers (something along the lines of an SDK or toolkit abstracting some internal web services). I'm using Autofac in order to inject different versions of the underlying services, mostly for stubbing. I want to distribute this assembly to a wide range of developers: users ...
At this point 2 Projection implementations are provided in Silverlight,
but none of them really do what I want.
I need something like the PlaneProjector class but
it only needs a RotationY property and it should raise an event
whenever this property is changed.
I can't create a sub class from PlaneProjector as it is sealed,
so my only...
I just referenced my application domain layer dll to the new WCF service that I am creating.
On my initial tests I am able to use and return the objects from my domain layer on the WCF service.
Question that come in my mind is none of my domain claseses have [DataContract] attribute so does this create a limitation or problem for me th...
Is it good practice to reference my web applications domain layer class library to WCF service application.
Doing that gives me easy access to the already existing classes on my domain model so that I will not need to re-define similar classes to be used by the WCF service
On the other hand, I don't like the coupling that it creates be...
I'm using SharpZipLib to create a zip file of a directory in a .NET 3.5 project, and I'm creating the archive like that :
fastZip.CreateZip(Server.MapPath(zipToPath), Server.MapPath(zipFromPath), true, null);
And that doesn't set neither files nor folders filters.
The problem is that the outcome zip file only has some of the sub-dire...
I have a set of linq to sql classes and serialized them into JSON using the .NET JavaScriptSerializer.
However, as soon as I add record onto a relating table, serialization throws a "Circular reference exception". Aaarggh!
It's described in detail here.
I have a few options
Convert the linq to sql class to a class with no relationsh...
Is it possible to create a WebBrowser control in a background thread in BackgroundWorker?
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Using web1 As New WebBrowser
End Using
End Sub
This throws the following error:
Ac...
Hello all,
I have a simple application using ADO.NET EntityFramework using a many-to-many relationship between two tables (with the use of a mapping table), let's say Books and Authors. I do have the foreign keys correctly associated between the three tables, I can add two Authors for the same Book and the data is written correctly in t...
In my application there is a specific time when a number of large objects are all released at once. At that time I would like to do a garbage collection on specifically the large object heap (LOH).
I'm aware that you cannot do that, you must call GC.Collect(2) because the GC is only invoked on the LOH when it is doing a generation 2 co...
I need to create some bitmaps and save them to the file system. For some reason the MScharting system wants it's background files supplies as paths in string form.
I'm dynamically creating the background image, although only a few times.
What's the best way to create these files and then clean them up?
...
In .NET scripting languages such as PowerShell and IronPython, when you want to use a .NET class you typically need to import the assembly name. Is there a quick way to find this information?
E.g. if I want to use System.Net.Mail, how do I quickly find out which assembly its in? I'm not necessarily looking for a programmatic way, even...
I'm using WCF to create a SOAP service with the following file layout hosted on IIS:
/
/web.config
/service
/service/test.svc
/service/web.config
In the /web.config, I have a few general settings (system.codedom, etc) and in the /service/web.config I have an appSettings section with a few settings defined.
<?xml version="1.0"?>
<conf...