Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

Lee Reid

@Lee Reid
About
Posts
13
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Performance stymied by UIElement_CreateAutomationPeer
    L Lee Reid

    Haha, well agreed to an extent. The maximum number of controls 'on' the window at any one time is actually around 200 (and usually only around 40) - the rest are held in memory waiting to be connected to the visual tree when scrolling takes place. I have tried virtualising these 'properly' so that they are re-used but the overhead for them binding to their data is actually more costly than having them just sit in memory (which I certainly found surprising)

    WPF com data-structures performance question

  • Performance stymied by UIElement_CreateAutomationPeer
    L Lee Reid

    Hey, I've been optimising a piece of software with a very large number of simple controls (~30000), most of whom have their parent panel virtualised at any one time (reducing the number in the visual tree to a few hundred). Running through ANTS profiler, I'm told that 60-70% of CPU-time is taken up by UIElement_CreateAutomationPeerDelegate.Invoke and its child methods. A user interacting with the program for 20 seconds or so [creating an additional ~20 of these controls, deleting a few, and moving a few around the page] results in this method being called 5.4 million times. Putting a counter near this method confirms this when run without debugging/ANTS. As far as I'm aware, I haven't touched AutomationPeer-related methods, and it is used for Accessibility/COM stuff. Can I turn this 'function' off, or are there ways of reducing how many times it is called? TIA, Lee

    WPF com data-structures performance question

  • Newbie problem: laying out grid issues in silverlight
    L Lee Reid

    Fully understood. Thanks so much for your time - it's really helped! Uses for dependency properties seem to be a lot more obvious now too... Cheers! :)

    WPF help css wpf docker question

  • Newbie problem: laying out grid issues in silverlight
    L Lee Reid

    Thanks so much! I had thought of the viewbox earlier but it only accepts one item. Your reply helped me realise that that one item could, of course, be a 1x1 grid holding all of the elements... Just for my learning's sake, if you did want to scale certain portions of the control only (e.g with your bike-wheel example) do you end up having to write your own container control?

    WPF help css wpf docker question

  • Newbie problem: laying out grid issues in silverlight
    L Lee Reid

    Hi everyone, I'm very new to silverlight, and trying to build a custom control which is made up of a series of paths/shapes which are of varying sizes. Is there some sort of container that exists which you can put a series of paths/shapes in, and when stretched it scales the whole lot like you'd scale a picture?? My problem is that whenever the control is resized, (e.g. while building main.xaml) my elements all scale by different amounts, because their margins are not scaled. e.g. Say the control (200x100) consists of A Grid (1x1) containing: --A Large Rectangle 200 x 100 [size of entire control, margins 0] --A Small Square 50x50 in the centre of the grid, [so margins are 75 L&R, 25 top&Bottom] When the control is squashed to e.g. 100x50, the margins for the small square are bigger than the entire control (75L+75R = 150), so the square vanishes. Conversely, when the control is doubled in width to 400 pixels, the small square grows not by 2x, but by 5x (from 50pixels to 250 pixels), because the margins are still 150pixels total. I need these margins to scale, so when the control is half the size, so are the margins and visa versa.... Or at least something that emulates that. I've tried trying to make the grid have a row/column for everything that needs laying out and using the 'star' system, but some of these controls will be made up of 20 or so different paths/shapes of different sizes and locations and it's beyond impractical to implement (also buggy :S ). Surely there's some sort of container that exists which you can just put paths/shapes in, and when stretched it scales the whole lot like you'd scale a picture?? Help!

    WPF help css wpf docker question

  • Zoom in on a label without changing the font size [modified]
    L Lee Reid

    Hi there, I need to be able to zoom in on a label without changing the text size (i.e. feed it a zoom factor, such as 2, and have it enlarge on the screen by that amount). Basically, a series of labels are part of a component used to set text sizes/layouts on a page. The component needs 'zoom' capability - e.g. zoom to 2x magnification. Clearly, changing the text size would be easy, but this means when the page is saved, the text sizes would have to be changed back ('rescaled') to zoom 1x, which seems awfully messy (esp if the user wants to edit the text size while it's zoomed). Is there an easier/less bothersome way? These do not *HAVE* to be labels, if a solution exists for a similar control (they could be, e.g. uneditable textboxes)... any help would be greatly appreciated :) thanks Lee EDIT: I ended up simply having to change the text size, in the 'messy' fashion I described above. It wasn't ideal, but did the job.

    modified on Thursday, February 17, 2011 9:08 PM

    C# css help question career

  • Need help with co/contravariance and generic lists :s
    L Lee Reid

    Thanks Dave! while not being the 'perfect' solution, you seem to have inadvertently solved another problem of mine, which I hadn't put to the forums yet! I appreciate the help :-)

    C# help tutorial csharp linq data-structures

  • Need help with co/contravariance and generic lists :s
    L Lee Reid

    Absolutely perfect! Thank you so much; I've not used ienumerable and related interfaces before, and didn't realise quite how elegant/easy/functional they could be. You've relieved quite a headache of mine! Thanks again

    C# help tutorial csharp linq data-structures

  • Need help with co/contravariance and generic lists :s
    L Lee Reid

    Cheers Dave, From what I understand unfortunately this seems to make a copy of the original - meaning that a list<B> is not actually contained within a List, but rather its contents are copied across. (Or am I mistaken??)

    List<B> listB = new List<B>();
    List<C> listC = new List<C>();

    List<A>[] arrayOfLists = new List<A>[2];
    arrayOfLists[0] = DerivedConverter<A, B>(listB);

    //listB count = 0, arrayOfLists[0].count = 0

    listB.Add(new B());

    //listB count = 1, but arrayOfLists[0].count = 0. I would want them BOTH to have counts of 1

    If i create a list<B> and a list<A>, changes made to listB need to be seen in listA. Sorry for the lack of clarity :(

    C# help tutorial csharp linq data-structures

  • Need help with co/contravariance and generic lists :s
    L Lee Reid

    Hey Kubajzz, thanks for your reply. I understand what you've said. Problem is that kind of jump-to-the-next-list iteration logic makes the whole thing very messy when the List**, List, etc lists are not in some sort of collection (i.e. where it is obvious as to which list to jump to without needing special programming). It also raises the problem that every class that subsequently derives from 'ClassX' requires a decent amount of overriding/patching if they add new lists (e.g. List, List). My project has several deriving classes, and values being entirely 'readonly' defeats the purpose of the whole class :( Is there not an easy way to collect these lists together in some sort of collection? Thanks heaps for your time

    modified on Monday, September 6, 2010 6:52 AM

    **

    C# help tutorial csharp linq data-structures

  • Need help with co/contravariance and generic lists :s
    L Lee Reid

    Hi guys, I need to find a way around a problem so that I can have an array containing lists of different types, where those types are all derived from the same class. Unfortunately I'm at the end of my knowledge of covariance etc so any help would be greatly appreciated. To explain better: I have a class ('class X') which has several lists in it. The lists contain different types, but these types all derive from the same abstract class. I need to be able to iterate through all items (i.e. across and within the lists) as though all the lists were one. For various reasons, the lists must remain as separate objects. Furthermore, 'Class X' is inherited, and derived classes have additional lists... My solution was to create an array containing these lists (which makes iterating with an unknown number of lists very easy), but I hit problems very quickly (e.g. see code below). Can anyone show me how to do something like this, or find a more elegant way to do it? Here's a much smaller, simple example of the kind of thing I'm trying to do:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
    abstract class A
    { }

    class B : A
    {    }
    
    class C : A
    {    }
    
    
    class ClassX
    {
        static void DoStuff()
        {
            List<B> listB = new List<B>();
            List<C> listC = new List<C>();
    
            List<A>\[\] arrayOfLists = new List<A>\[2\];
    
            arrayOfLists\[0\] = listB;//Error	1	Cannot implicitly convert type 'System.Collections.Generic.List<ConsoleApplication1.B>'
            arrayOfLists\[1\] = listC;//Error	2	Cannot implicitly convert type 'System.Collections.Generic.List<ConsoleApplication1.C>'
    
            arrayOfLists\[0\] = listB.Cast<A>().ToList();//Subsequent changes in list B are not seen an arrayoflists because a new object is created
    
            List<List<A>> listOfLists = new List<List<A>>();
            listOfLists.Add(listB);//Error	4	Argument 1: cannot convert from 'System.Collections.Generic.List<ConsoleApplication1.B>' to 'System.Collections.Generic.List<ConsoleApplication1.A>'
        }
    }
    

    }

    Thanks! Lee

    C# help tutorial csharp linq data-structures

  • Make main window wait for message box
    L Lee Reid

    SOLVED! Thanks so much! When you're new, the smallest things can be so retardedly difficult to find solutions for...

    C# question help

  • Make main window wait for message box
    L Lee Reid

    Hi guys/girls, When you use MessageBox.Show("message here"), the programme will effectively freeze and wait for you to press OK on the message box before continuing in the code. How do I make this happen for my own custom built pop-up windows? I'm sure this should be simple but i'm stumped :( Any help would be great! Thanks in advance :) Lee

    C# question help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups