|
One way to achieve this would be to have your collection implement INotifyCollectionChanged (if using ObservableCollection is out of bounds), and use a mediator class to monitor the changes. Obviously you'd want to use INotifyPropertyChanged for individual items in the collection.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Would using a DataGridView be a better option? I don't want anything fancy - I just need the listview to update items that have changed (possibly hundreds of items changing every 2 or three seconds or so).
BTW, this isn't a WPF application...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I don't know that DGV would be a better choice. The fact that the listview supports virtualisation is a big plus. BTW - I figured it wasn't WPF.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
Hi,
I want monitor com port already open. I am tring to use win api, with overlapped I/O setting, but don't work.
I suppose need to intercept windows event that contain data excanged from application to com port.
Qualcuno ha un idea su come fare??
Thanks in advance,
Cris
http://bugbusters.altervista.org[^]
|
|
|
|
|
I'm trying to create a Component that sits in the Forms designer component tray and contains additional subcomponents that can be selected and configured via the document outline view (or through a collection property of the main component).
I've looked at numerous code project articles and even peeking at some MS components that behave kind of like this (e.g. ListView), but I can't seem to get my sub-components to show up in the Document Outline.
The MSDN is non-helpful in this area, their "documentation" consists of is a 2 sentence blurb describing an esoteric example and then 10 pages of code that assumes an intimate understanding of the entire .NET component model.
Anyone know of a good source of documentation on this area, or better yet any tips on what I might try?
Thanks,
-Chris
[solved]
I figured out how to do it. In my main component, add a custom designer:
[Designer(typeof(MyDesigner), typeof(IDesigner))]
public class MyComponent : Component
Then in MyDesigner , inherit from System.ComponentModel.Design.ComponentDesigner and override a couple methods, shown below:
public override void Initialize(IComponent component)
{
base.Initialize(component);
_myComponent = (MyComponent) component;
}
public override System.Collections.ICollection AssociatedComponents
{
get
{
if (_myComponent == null)
{
return base.AssociatedComponents;
}
return _myComponent.Subcomponents;
}
}
Now my sub components are selectable via Document Outline, but suppressed in the component tray (so as to keep it tidy).
modified on Friday, December 4, 2009 11:57 AM
|
|
|
|
|
Dear All:
I have a major problem, my web application was supposed to be multinational, so i worked through resource files. But the problem am facing can't be solved by resource file, when i get date Date.Now.DaysOfWeek
the date is in english such as "Monday" how could i directly retrieve the date "Lundi" which is using the french culture.
|
|
|
|
|
Check out the remarks section of this[^] page.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Oh no, not the documentation again!
|
|
|
|
|
|
I have this piece of code that "selects" from an Excel data stream and also from an XML one:
foreach (var ex in dataExcel)
{
ExcelRecs++;
IEnumerable<xelement> part =
from item in Partlists.Descendants("Partx")
where (string)item.Element("Part_name") == ex.Name
select item;
.....
}
How do I make the comparison "case INSENSITIVE"? that is either one of item.Element("Part_name") or ex.Name can be upper case and the other lower case, the == comparise would still be true.
Thanks for your help!
|
|
|
|
|
you want to compare two strings in a special way?
what class could possibly help you?
and what would be a nice name for a relevant method in such class?
|
|
|
|
|
Luc Pattyn wrote: what class could possibly help you?
and what would be a nice name for a relevant method in such class?
I know! I know!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Luc Pattyn wrote: you want to compare two strings in a special way?
what class could possibly help you?
Oooh oooh! Is it CompareTwoStrings.InASpecialWay ?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
you're giving it away!
|
|
|
|
|
Use string.Compare .
var part = from item in Partlists.Descendants("Partx")
where string.Compare((string)item.Element("Part_name"), ex.Name, true) == 0
select item;
Best wishes,
Navaneeth
|
|
|
|
|
Thank you very much Navaneeth! That's what I was looking for!!
|
|
|
|
|
Hi,
I have a problem with VS2010beta2 and .NET Framework Client Profile, although I would expect the problem to be something to do with my inexperienced coding.
I have this block of code..
struct sGamePort
{
public string sgpProtocol;
public UInt16 sgpPortStart;
public UInt16 sgpPortEnd;
}
struct sGamePortItem
{
public string sgpName;
public List<sGamePort> sgpPortList;
}
List<sGamePortItem> sGames;
private sGamePort ParsePorts(string[] line)
{
sGamePort gp = new sGamePort();
gp.sgpProtocol = line[0];
int num = line.Count();
if (num == 2)
{
gp.sgpPortStart = Convert.ToUInt16(line[1]);
gp.sgpPortEnd = Convert.ToUInt16(line[1]);
}
if (num == 3)
{
gp.sgpPortStart = Convert.ToUInt16(line[1]);
gp.sgpPortEnd = Convert.ToUInt16(line[2]);
}
return gp;
}
Where line is a string array which essentially holds some tokens.
ie.
line[0] = "NAME"
line[1] = "JOHN"
line[2] = "YOUNG"
Now, in a seperate function I have
sGamePortItem pi = new sGamePortItem();
pi.sgpProtocol = "TCP";
pi.sgpPortList.Add(ParsePorts(strCMD));
This gives me a Null Reference Exception, so I changed it to this...
sGamePortItem pi = new sGamePortItem();
pi.sgpProtocol = "TCP";
sGamePort test = new sGamePort();
test = ParsePorts(strCMD);
pi.sgpPortList.Add(test);
Now, the error only occurs on the specified line above.. What am I doing wrong? Is it to do with me using the new keyword incorrectly? Or do I not use 'new'?
Any help would be appreciated as this has been confusing me for a few hours now, lol
Thanks again.
John
Yippee Kai Yai
Signed Polomint.......
|
|
|
|
|
The problem is that your line:
public List<sGamePort> sgpPortList;
should be:
public List<sGamePort> sgpPortList = new List<sGamePort>();
Need to assign a target to sgpPortList before you dereference it, hence the null ref exception.
|
|
|
|
|
Damn, I knew it would be something trivial...
Thanks for waking me up to a silly mistake,
EDIT:
Now I'm getting the error "cannot have instance field initializers in structs"...
Hmmm, this could be a pain...
EDIT AGAIN:
I realised what was wrong.. I hadn't been initialising the sGamePortItem in the list..
sGamePortItem pi = new sGamePortItem();
pi.sgpPortList = new List<sGamePort>();
Thank you for your help, it made me think more about the initialisation...
Yippee Kai Yai
Signed Polomint.......
modified on Thursday, December 3, 2009 2:09 PM
|
|
|
|
|
You need to initialize the list of the struct "sGamePortItem" before assigning the object.
|
|
|
|
|
Hi,
I am developing a web app in VB.NET 1.1. In some Webforms I call a showModalDialog child, but when I close it, the parent session is removed.
Please, how can I hold it?
Thanks in advance,
Jose Alvarez de Lara
|
|
|
|
|
Modal dialogues can't refer to their parent using opener. You need to pass a reference to the parent in the second parameter to showModalDialog.
|
|
|
|
|
Hi Puri,
That is what I did. And I maintain a conversation between then parent and the child.
I am thinking if it is possible to send the parent session to the child and bring it back
to the parent when close the child.
Thanks for your interesting,
Jose
|
|
|
|
|
Hello,
There are two articles here in the Code Project. I am talking about "Those Crazy Popups" and "ASP.Net Modal Window Server Control". I am looking for something like them, but I need to fix those articles into my issue.
Any help will be appreciate.
Regards,
Jose
|
|
|
|