Click here to Skip to main content
15,889,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: limit memory c# Pin
Dave Kreskowiak12-Mar-12 10:08
mveDave Kreskowiak12-Mar-12 10:08 
AnswerRe: limit memory c# Pin
OriginalGriff12-Mar-12 7:28
mveOriginalGriff12-Mar-12 7:28 
AnswerRe: limit memory c# Pin
jschell12-Mar-12 8:55
jschell12-Mar-12 8:55 
Questiondefining a row grid within a column grid, c#, wpf Pin
Sutton Mehaffey12-Mar-12 3:37
Sutton Mehaffey12-Mar-12 3:37 
AnswerRe: defining a row grid within a column grid, c#, wpf Pin
Wes Aday12-Mar-12 3:55
professionalWes Aday12-Mar-12 3:55 
AnswerDuplicate post Pin
Pete O'Hanlon12-Mar-12 4:10
mvePete O'Hanlon12-Mar-12 4:10 
QuestionProblem with Exchange server monitoring Pin
Sebastian T Xavier11-Mar-12 19:05
Sebastian T Xavier11-Mar-12 19:05 
QuestionMethods of a collection class are not always called Pin
CDP180211-Mar-12 16:52
CDP180211-Mar-12 16:52 
I have a collection class to hold the children of a control in a DIY user interface. The UI allows to add new controls by calling the Add() method of the collection. Nothing special and breakpoints in Add() are reached as long as the calls come from my own code. Everything is as it should be. Alternatively a view can also be loaded from XAML (using the XamlServices class). If that is done, the view is loaded correctly, but none of the breakpoints in any of the collection's methods are reached. As a result the parent control does not react to layout changes when children are added or removed. Still, XamlServices has successfully loaded the controls and their children, just none of my methods have been used and the layout has not been updated.

According to MSDN, XAML fills the collection with reflection (no real surprise) and looks for the IList interface to do that. I have implemented the complete IList interface and set breakpoints in all of the methods and properties, but they are only reached when the methods are called from my own code. Also, the collection may not be a generic list itself, but may be derived from a generic list. That is why I implemented my collection the following way:

public class ControlList : List<Control>, IList // Component is one of my own classes, not WPF, Silverlight or anything else of the usual!
{
    // Just one of the many IList methods
    public new void Add(cPraeComponent oComponent)
    {
        // Here comes code that is only executed when not using XAML
    }
}


I am convinced that XAML calls the methods of the baseclass (the generic list) instead of mine. My only idea up to now is to wrap the whole collection in a wrapper class which does not inherit from anything and implements IList, but this would be one ugly workaround. Does anybody have a better idea?

Edit: I tried deriving the collection from (forgive me) ArrayList, but that also did not change anything. It really looks like XAML always ends up calling the baseclass and not my methods.
I'm invincible, I can't be vinced



AnswerRe: Methods of a collection class are not always called Pin
Luc Pattyn11-Mar-12 17:26
sitebuilderLuc Pattyn11-Mar-12 17:26 
GeneralRe: Methods of a collection class are not always called Pin
CDP180211-Mar-12 23:34
CDP180211-Mar-12 23:34 
GeneralRe: Methods of a collection class are not always called Pin
lukeer12-Mar-12 3:11
lukeer12-Mar-12 3:11 
AnswerRe: Methods of a collection class are not always called Pin
Luc Pattyn12-Mar-12 3:26
sitebuilderLuc Pattyn12-Mar-12 3:26 
GeneralRe: Methods of a collection class are not always called Pin
CDP180212-Mar-12 4:03
CDP180212-Mar-12 4:03 
AnswerRe: Methods of a collection class are not always called Pin
Luc Pattyn12-Mar-12 4:23
sitebuilderLuc Pattyn12-Mar-12 4:23 
GeneralRe: Methods of a collection class are not always called Pin
CDP180212-Mar-12 21:21
CDP180212-Mar-12 21:21 
AnswerRe: Methods of a collection class are not always called Pin
Pete O'Hanlon11-Mar-12 20:01
mvePete O'Hanlon11-Mar-12 20:01 
GeneralRe: Methods of a collection class are not always called Pin
CDP180212-Mar-12 0:07
CDP180212-Mar-12 0:07 
GeneralRe: Methods of a collection class are not always called Pin
Pete O'Hanlon12-Mar-12 0:43
mvePete O'Hanlon12-Mar-12 0:43 
AnswerRe: Methods of a collection class are not always called Pin
Bernhard Hiller11-Mar-12 21:18
Bernhard Hiller11-Mar-12 21:18 
GeneralRe: Methods of a collection class are not always called Pin
CDP180212-Mar-12 0:27
CDP180212-Mar-12 0:27 
QuestionExport to Excel - DropDownList Pin
Andrew Woodward11-Mar-12 10:12
Andrew Woodward11-Mar-12 10:12 
Questioninsert image in datagrid Pin
MemberDotNetting11-Mar-12 9:06
MemberDotNetting11-Mar-12 9:06 
AnswerRe: insert image in datagrid Pin
OriginalGriff11-Mar-12 9:41
mveOriginalGriff11-Mar-12 9:41 
GeneralRe: insert image in datagrid Pin
MemberDotNetting12-Mar-12 7:09
MemberDotNetting12-Mar-12 7:09 
Questioncombobox Pin
MemberDotNetting11-Mar-12 4:42
MemberDotNetting11-Mar-12 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.