|
Thanks I came across the CollectionViewSource already. But since my project is almost complete and based on Observable collection I didn't want to change everything.
Anyway now the sorting is solved and working properly (see previous post).
|
|
|
|
|
Hi,
In my application on clicking a link i m opening an aspx page in different IE window.Now I want to display "Loading..." on the parent IE window's status bar untill the new window opens when the link is clicked.
|
|
|
|
|
Try HtmlPage.Window.SetProperty("defaultStatus", "Loading..."); .
However, note this is only for IE.
I'm not sure what you need to do for Firefox or other browsers.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
|
You are welcome. Vote or mark as answered if this answer helped though.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
modified on Tuesday, March 15, 2011 8:05 AM
|
|
|
|
|
I'm curious. Why vote the answer? Surely a better indication would be to mark the answer as SOLVED. That's what these forums are about after all.
|
|
|
|
|
Yes. Fair enough.
'Mark as answered' is still relatively new so I keep forgetting about it.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Abhinav S wrote: 'Mark as answered' is still relatively new so I keep forgetting about it
Fair enough. When you don't ask many questions, but rather spend all your time answering them, it's an easy one to forget.
|
|
|
|
|
I dont know how to use Linq in Silverlight 4.0
I add it into Project.Web but it useless
PLease help me. Thanks
(I dont good at English. But i can read. Thanks )
|
|
|
|
|
You can use LINQ in Silverlight pretty much the same way you use it in C#.
Do you mean LINQ to XML etc?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Are you trying to execute a Linq to SQL query from Silverlight? If you are, then you can't do this. What you should do is investigate the RIA services that Silverlight uses - google for Silverlight RIA to get an understanding of how to use them.
|
|
|
|
|
I' curious Pete, do YOU use the RIA services, I don't as I like to roll my own but I'm interested to know if some of the more exprerienced devs here use things like RIA or EF.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I do use RIA and EF. I don't do much with RIA because my primary focus is desktop development, but I've done a fair bit with EF since version 2. V5 looks to be quite decent. While I like to roll my own code, as much as the next man, there comes a point where I have to look at the investment cost and think that using something that somebody else has built may be cheaper. There are lots of factors that go into my decision on that topic.
|
|
|
|
|
I was faced with a similar decision just a few weeks ago regarding POP3 email clients.
I could have written it but it wouldn't benefit from even a percentile of the level of rigorous testing that a £100 commercial solution would provide. Let alone the financial savings over spending a few weeks developing it.
|
|
|
|
|
While I'm more than happy to use 3rd party controls, the whole data/entity layer I feel a need to have complete control of. I first wrote a code generator so my investment in re coding is minimal and I feel I get a better understanding and certainly control of that layer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Dear All,
I am using SilverLight 4 with Asp.Net 4.0
I am using edmx file in that I have put my required table which have relation in between.
To access these table in MYPage.xaml, I have create service using bellow code
//------------------------------------------------------------------------
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("Resource_MT", EntitySetRights.All);
config.SetEntitySetAccessRule("ProjectResourceAllocations", EntitySetRights.All);
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
//------------------------------------------------------------------------
After that I have create Service Reference.
After this I have create My linq join query.
after this, I want to execute this query.
I am able to execute single table query like
//---------------------------------------------------------------------------------
var dsQueryResource = (DataServiceQuery<ServiceReference2.Resource_MT>)queryResource;
dsQueryResource.BeginExecute(OnResourcesQueryComplete, queryResource);
//---------------------------------------------------------------------------------
But as i have two table which is 1)Resource_MT 2)ProjectResourceAllocations
How can I do this??
As I am very new in Silverlight. Please Help me on this.
For your information here is my LINQ join query
//---------------------------------------------
var queryResource = from p in svcContext2.ProjectResourceAllocations
join r in svcContext2.Resource_MT on p.ResourceID equals r.ResourceID
where p.ProjectID == UserSelectedProjectID
select r.FirstName;
//---------------------------------------------
Waiting for your reply.
|
|
|
|
|
Hi,
I'm trying to learn about creating ribbons through the Microsoft Ribbon Library. I was just wondering if there is a way to use the same icons used in Microsoft Office ribbons? Thank you in advance.
Regards,
Raymond
|
|
|
|
|
Silverlight has a ribbon control [^]that you can always use.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Eek.
I'm using the Mediator pattern (a variation of the one from MVVM Foundation) using weak references to allow Messages to be sent to View Models while not keeping a reference to that view model.
I had a load of VMs created, each registered for messages. When a View is 'closed' all references to the VM are removed (including the DataContext of the view)
So with no references it should be garbage collected, right?
Well if I use a profiler, it does seem to disappear from the map. All good.
So another part of the program sends a message to which my hopefully-garbage collected VM was responding.
Do you think the VM with no references responds to the message? The VM with no references? Yes - it Does! Even though I'm only accessing it via Weak references, and there are no real references to it, it has not been garbage collected .
So a VM which should have been disposed of, handles a message!!!!!!
Help!
I've a work-around - I force Garbage Collection after removing the reference to the VM from the View - but that feels ugly to me.
So the real solution would seem, to me, to remove all messages for a VM when the final reference to the VM is removed.
But that's a little pro-active (i.e. I am relying on the programmer writing code to remember to remove messages which is just about as likely to happen as the programmer removing all event handlers across objects!)
so now I am wondering is it possible, using a weak reference, to check if an object has any strong references? If I can do so, then I can automatically ignore sending messages to un-GarbageCollected objects that have no references (and remove those messages from my Mediator collection.
(I emboldened the actual question as I do tend to waffle a lot and I know you guys are busy chaps)
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
_Maxxx_ wrote: Do you think the VM with no references responds to the message? The VM with no references? Yes - it Does! Even though I'm only accessing it via Weak references, and there are no real references to it, it has not been garbage collected .
That suggests that you actually have a strong reference to it rather than a weak reference. Remember that a weak reference does not guarantee that a strong reference will not be taken, or that the reference will be downgraded back to a weak reference afterwards. This is one of the reasons that my implementation of the mediator provides a method to dereference messages.
|
|
|
|
|
Pete O'Hanlon wrote: That suggests that you actually have a strong reference to it rather than a weak reference.
That's what I thought - but using ANTS there are no strong references - indeed if I do a GC.Collect then it "goes away" entirely and the problem is no linger a problem
The problem seems to me to be that, after an object is ready for garbage collection, it may or may not be collected at any time - the GC doesn't actually collect it until it needs some memory (or you force it to garbage collect)
Having to dereference messages when a VM is finished with strikes me as as bad a problem as remembering to remove event handlers - and just as hard to track down problems!
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
As Pete said, why bother with weak references here? A VM who doesn't unsub from the messenger events is being kind of douchey, wouldn't you say? Don't confuse WeakReferences with bad programming . I guess its good to be able to handle bad code.
Anyways, in answer to your real question, WeakReference has the IsAlive property that you can use.
EDIT: As a side note, I've often found WeakReferences to be trouble prone... cuz a douchey / lazy developer might do:
Whatever.Blah = new SomeObject();
Guess what happens here? Blah is a WeakReference behind the scenes and the new SomeObject() goes out of scope immediately and gets GC'ed because there was no strong reference to it .
|
|
|
|
|
SledgeHammer01 wrote: As Pete said, why bother with weak references here? A VM who doesn't unsub from the messenger events is being kind of douchey, wouldn't you say? Don't confuse WeakReferences with bad programming . I guess its good to be able to handle bad code.
I guess I was thinking that using the weak references and messages rather than events would get around the issue of programmers forgetting to remove event handlers across objects when the object is finished with.
If you still need to remove your registration from the messenger, then I'm not sure what the advantages of messaging over eventing are.
It is actually obvious when you think about it, but the issue I am having (where the object is ready for GC but has not yet been GCd, but the objects is still available due to a weak reference somewhere) is as dangerous as all hell.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
The IsAlive property gives you some safe guards, but there is still kind of a race condition. WeakReferences are only there so you don't lock an object from getting GC'ed (duh), but as Pete explained, its easy for an object to go back and forth between weak only and weak & strong. Also, in the example I gave you, its entirely too easy to completely defeat the purpose of weak references because if your object is init'ed inline like that, it'll get GC'ed right away and you'll be debugging code for hours. In that case, you'd need to keep a strong reference to it anyway.
I remember working on a piece of code, I forget what it was right now, but it was something related to commanding & event handlers in some part of .NET (buttons I think). Anyways, I subbed to an event and couldn't for the life of me figure out why the event handler was only getting called once.
Turns out Microsoft had decided to use a weak reference for that particular thing and:
blah.whatever += new EventHandler(...);
was getting GC'ed right away (the event handler I mean was getting GC'ed).
I had to save a strong reference to the event handler in my class. I thought that was really ugly.
Best to avoid weak references IMO. They are often tricky to debug when you forget they are there and just kind of serve as a band aid for sloppy programming.
If a view doesn't unsub from something and causes a leak, why not fix the view rather then hide the problem?
|
|
|
|
|
SledgeHammer01 wrote: If a view doesn't unsub from something and causes a leak, why not fix the view rather then hide the problem?
COuldn't agree more!
S'funny. I started off a while ago asking about why people use messages rather than events - I mean my ViewModel can subscribe to an event raised by another "some singleton object" in response to a request by a ViewModel
I didn't get the difference between that and the situation where my ViewModel can subscribe to a message sent by "some singleton object" in response to a request by a viewmodel.
The difference as I understood it was allowing weak references to be used - but that's really only an advantage I think if you subscribe from one VM directly to an event raised by another VM - rather than some singleton...
I feel lI must be missing something, and perhaps need to go back and read the various articles about this - because I'm back to squeare one again now - thinking I may as well use familiar old events
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|