Search Results

Search found 9 results on 1 pages for 'number8'.

Page 1/1 | 1 

  • Implementing ToArgb()

    - by Number8
    Hello -- System.Drawing.Color has a ToArgb() method to return the Int representation of the color. In Silverlight, I think we have to use System.Windows.Media.Color. It has A, R, G, B members, but no method to return a single value. How can I implement ToArgb()? In System.Drawing.Color, ToArgb() consists of return (int) this.Value; System.Windows.Media.Color has a FromArgb(byte A, byte R, byte G, byte B) method. How do I decompose the Int returned by ToArgb() to use with FromArgb()? Thanks for any pointers...

    Read the article

  • XML databinding to TreeView (or Tab control), bind attribute based on different attribute

    - by Number8
    Hello, I have some xml: <Test> <thing location="home" status="good"/> <thing location=work" status="bad"/> <thing location="mountains" status="good"/> </Test> The leaves on the TreeView are the values of the status attribute; the nodes will be the value of the location attribute. +--bad ¦.....+--work +--good .......+--home .......+--mountains Currently, I populate the TreeView (or Tab control) manually, iterating through the xml, adding the nodes to the appropriate leaf. Can this be done via databinding? I'm guessing a Converter will be involved... Thanks for any advice.

    Read the article

  • SL4: Root element is missing

    - by Number8
    Hello, I know this has been asked elsewhere, but none of the questions or answers helped. I open an xml file in my SL 4 app: StreamResouceInfo sri = Application.GetResourceStream(new System.Uri("z.xml", UriKind.Relative)); if (null != sri) { XDocument xDoc = XDocument.Load(sri.Stream); } "Root element is missing" exception. The xml: Hmm, can't seem to post the xml... It is well-formed and valid, with a single root node and all tags closed. Thanks for any hints...

    Read the article

  • Show all objects on canvas in window

    - by Number8
    Hello -- We have a canvas with a large number of objects. The user can pan and zoom the view of the canvas. I am trying to figure out how to implement "show entire canvas" -- that is, zoom and center the canvas in the window to show all objects. We know the max and min X and Y coordinates. I am looking at our current zoom and pan implementations to try to figure out if there is a way to use them. Any suggestions on how to do this would be appreciated... Thanks.

    Read the article

  • Can a WPF base class contain a control for a derived class?

    - by Number8
    Hello, I have several UserControls that have some of the same controls doing the same job. Is it possible to extract those controls into a base class? When I have tried it, I get an error that the definition in the generated .g.cs file will hide the parent def. What I would like to do: public class ctlBase : UserControl { internal CheckBox chkBox { get; set; } } In the .xaml of the derived class: <Grid> <CheckBox x:Name="chkBox" /> </Grid> public class DerivedCtl : ctlBase { } Thanks for any insights...

    Read the article

  • Printing in Silverlight 4

    - by Number8
    Hello, We have an application structured roughly like this: <Grid x:Name="LayoutRoot"> <ScrollViewer> <Canvas x:Name="canvas"> <StackPanel> < Button /><Slider /><Button /></StackPanel> <custom:Blob /> <custom:Blob /> <custom:Blob /> </Canvas> </ScrollViewer> </Grid> Each Blob consists of 1 or more rectangles, lines, and text boxes; they are positioned anywhere on the canvas. If I print the document using the LayoutRoot: PrintDocument pd = new PrintDocument(); pd += (s, pe) => { pe.PageVisual = LayoutRoot; }; pd.Print("Blobs"); ... it is like a print-screen -- the scrollbars, the sliders, the blobs that are visible -- are printed. If I set PageVisual = canvas, nothing is printed. How can I get all the blob objects, and just those objects, to print? Do I need to copy them into another container, and give that container to PageVisual? Can I use a ViewBox to make sure they all fit on one page? Thanks for any pointers....

    Read the article

  • Startup params for Silverlight 4 app

    - by Number8
    Hello -- We are moving our SL3 app to SL4. First step was to open it in VS2010; it converted w/o problem. However, parameters specified for the start page are not passed along. That is, if we specify ourStartPage.aspx?Slam=Dunk&Glass=Sun in app.xaml.cs, Application_Startup(), e.InitParams is empty. How do we fix this? Thanks for any advice.... (Note that the very same startup string worked in VS2008.)

    Read the article

  • C# memory / allocation cleanup

    - by Number8
    Some near-code to try to illustrate the question, when are objects marked as available to be garbage-collected -- class ToyBox { public List<Toy> Toys = new List<Toy>(); } class Factory { public ToyBox GetToys() { ToyBox tb = new ToyBox(); tb.Toys.Add(new Toy()); tb.Toys.Add(new Toy()); return tb; } } main() { ToyBox tb = Factory.GetToys(); // After tb is used, does all the memory get cleaned up when tb goes out of scope? } Factory.GetToys() allocates memory. When is that memory cleaned up? I assume that when Factoy.GetToys() returns the ToyBox object, the only reference to the ToyBox object is the one in main(), so when that reference goes out of scope, the Toy objects and the ToyBox object are marked for garbage collection. Is that right? Thanks for any insights...

    Read the article

  • Big o notation runtime

    - by mrblippy
    Hi, i have been given some code to work out big o runtimes on them, could someone tell me if i am on the right track or not?? //program1 int i, count = 0, n = 20000; for(i = 0; i < n * n; i++) { count++; } Is that O(n^2)??? //number2 int i, inner_count = 0, n = 2000000000; for(i = 0; i < n; i++) { inner_count++; } is this one O(n)???? //number3 for(i = 0; i < n; i++) { for(j = 0; j < n; j++) { count++; } } O(n^2)????? //number4 for(i = 0; i < n; i++) { for(j = 0; j < i; j++) { for(k = 0; k < j; k++) { inner_count++; } } } is that O(n^3)????? //number5 int i, j, inner_count = 0, n = 30000; for(i = 0; i < n; i++) { for(j = 0; j < i; j++) { inner_count++; } } is that one O(n^3)? //number6 int i, j, k, l, pseudo_inner_count = 0, n = 25; for(i = 0; i < n; i++) { for(j = 0; j < i*i; j++) { for(k = 0; k < i*j; k++) { pseudo_inner_count++; for(l = 0; l < 10; l++); } } } very confused about this one O(n^3)?? //number7 int i, j, k, pseudo_inner_count = 0, n = 16; for(i = n; i > 1; i /= 2) { for(j = 0; j < n; j++) { pseudo_inner_count++; for(k = 0; k < 50000000; k++); } } o(n)???? (i get more lost as they get harder) //number8 int i, j, pseudo_inner_count = 0, n = 1073741824; for(i = n; i > 1; i /= 2) { pseudo_inner_count++; for(j = 0; j < 50000000; j++); } O(n^2)??? If anyone could clarify these and help me understand them better i would be very grateful -cheers

    Read the article

1