|
Do you have a XAML file open in the designer while trying to add or view the ToolBox contents?
VS hides the tools until you have opened a XAML file, then the toolbox lights up and the tools appear.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Got it Thanks mate!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Via a Canvas and 6 polylines, I have a good amount of data plotted on the screen, and I've noticed that even without updated the polylines (changing their values), the processor becomes bogged down when I simply move the cursor over the canvas. I realize the OS must redraw the screen when the mouse moves, but could there be something with the way I'm using the Canvas, that creates unnecessary rendering? I mean, all I'm doing is moving the mouse anywhere over the canvas, and I experience a processor usage jump of ~50-60%. I'm not using a MouseOver event either. Any thoughts?
|
|
|
|
|
Can you post the XAML?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
in the current application, i'm not continuously updating the gridlines or polylines. I've simply added points to them, and then displayed them. there's not a whole lot of code other than that..
<code>
<Canvas Name="Canvas_Plot" ClipToBounds="True" Background="Black">
<Line Name="Vertical_Gridline1" Stroke="LightSkyBlue" StrokeThickness="1" Opacity=".5"></Line>
<Line Name="Vertical_Gridline2" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Line Name="Vertical_Gridline3" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Line Name="Vertical_Gridline4" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Line Name="Horizontal_Gridline1" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Line Name="Horizontal_Gridline2" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Line Name="Horizontal_Gridline3" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Line Name="Horizontal_Gridline4" Stroke="LightSkyBlue" Opacity=".5"></Line>
<Polyline Canvas.Left="0" Name="PlotLine1" StrokeLineJoin="Round" Stroke="White" StrokeStartLineCap="Flat" StrokeThickness="2">
</Polyline>
<Polyline Canvas.Left="0" Name="PlotLine2" StrokeLineJoin="Round" Stroke="White" StrokeStartLineCap="Flat" StrokeThickness="2">
</Polyline>
<Polyline Canvas.Left="0" Name="PlotLine3" StrokeLineJoin="Round" Stroke="White" StrokeStartLineCap="Flat" StrokeThickness="2">
</Polyline>
<Polyline Canvas.Left="0" Name="PlotLine4" StrokeLineJoin="Round" Stroke="White" StrokeStartLineCap="Flat" StrokeThickness="2">
</Polyline>
<Polyline Canvas.Left="0" Name="PlotLine5" StrokeLineJoin="Round" Stroke="White" StrokeStartLineCap="Flat" StrokeThickness="2">
</Polyline>
<Polyline Canvas.Left="0" Name="PlotLine6" StrokeLineJoin="Round" Stroke="White" StrokeStartLineCap="Flat" StrokeThickness="2">
</Polyline>
</Canvas>
</code>
|
|
|
|
|
jlgeris wrote:
What is the Code tag?
The above runs like a rocket ship on my system. 0% CPU.
Your lines don't have any x or y so they are all super small and don't do anything.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
the Code tag was me not entering my code in correctly into the meassge box
well, i set the xy's in the c# code. it's hard for me to show, b/c the system slows when i add a few thousand points to each of the polyline. common sense says, right, there's a lot of data in memory to plot these lines, but i wouldn't expect so much processing when i'm not manipulating the data contained in the polylines.
when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
|
|
|
|
|
jlgeris wrote: when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?
Do you have any RoutedEvent handlers in your application?
Are these lines being constructed with code or are they databound to a class/properties?
What role does the mouse play in your application?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I have some event handlers for other controls, but not relating to the canvas. The lines are being constructed with code, basically:
PointCollection pc = BunchOfPoints;
polyline.points = pc;
this is done 6 times
Right now the mouse doesn't play a role. I would like to be able to manipulate the display, but right now the system slows down if i simply move the mouse over.
|
|
|
|
|
I guess we have ruled out the obvious.
Is there any way to reduce the number of points?
I'm not sure what your doing or why, so I have to spitball here.
Can you average points to reduce the number of points?
Can you end user see the difference between 1000 points and 500 points?
Are the values between each point that great, if not then you can plot every 2nd, 3rd, 4th, etc point.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
jlgeris wrote: he system slows when i add a few thousand points to...
Funny
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i could do this using GDI w/o a problem...
|
|
|
|
|
A few thousand points per line does sound like a huge number!
Jammer
Going where everyone here has gone before!
|
|
|
|
|
What are counterparts of these methods in WPF? I drawed 2 intersecting polygons and I would like to bring one of them into front.
Thanks for help
|
|
|
|
|
You will want to use the ZIndex property to adjust their display order.
You can also Google: "wpf sendtoback" and you'll find an article on this.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
A Polygon class doesn`t have such property.
|
|
|
|
|
Read up on the ZIndex property. It is an attached property that is exposed by panels like the Canvas.
Canvas.ZIndex="99"
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi All,
I'm just doing a bit of a review on a WPF app I'm working on at work and we have a few user controls at the moment which are being treated with the usual .Visible / .Hidden method of showing and hiding various bits of the interface.
However, I'm just looking into converting this setup using layers instead of having to make each control hidden or visible each time a navigation button is changed.
Has anyone here used them? I can't find anything about them in the Adam Nathan book WPF Unleashed and it appears that they are something to do with Blend ...
The grid declaration is like:
<Grid d:IsLayer="True" x:Name="Layer"
Which is hooked up to a namespace of:
xmlns:d="http://schemas.microsoft.com/expression/blend/2006"
Seems like a nice solution but was just wondering if anyone here knows of any potential pitfalls?
Cheers,
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Jammer,
WPF does not have the concept of layers like in Photoshop for example.
That markup you are seeing is something that Blend puts in. I honestly do not know why it does it.
You can use the ZIndex to bring objects to the front or send them to the rear.
You can also do some cool things with the Grid control as it stacks controls on top of each other unless you move them with margins or place in other rows or columsn.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
That is interesting. I picked this up from the Microsoft Expression Blend Bible by Gurdy and Mary Leete.
They even go on to describe how you can programmatically change the visibility of the layers from C# ...
Layer1.Visibility = Visibility.Visible/Hidden ...
I did have the controls stacked on top of each other originally and I suppose you could do some efficient Hidden/Visible switching using borders to control their children.
I just liked the idea of using layers and switching just two things each time a navigation button is clicked rather than having a long list of user controls and so on ...
Regards,
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Now that I have added these layers into the blend project they are appearing as objects in the intellisense inside VS2008 and have the Visibility property ready for managing multiple controls ...
Layers seems to work as expected ...
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Jammer wrote: Layer1.Visibility = Visibility.Visible/Hidden
Layer1 is the name of a control like a StackPanel, Grid, Border, etc., but it's not a "true" layer like Photoshop. However, it may be easier for designers to think in terms of layers of controls by naming them, but just keep in mind, there is no Layer control.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Indeed.
Just for terminology its a handy thing. I've not confirmed this but it would makes sense that you could control any 'group' of UI controls but tying visibility switching to their parents in the visual tree ... such as a border.
Either way its tidying up my code-behind nicely.
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Oh MY!
Karl!! Great, Great, Great job on Mole ... have been using it for a week now ... SO HANDY!!
Thank you!
I blogged about it on my own personal blog last wednesday and by thursday I was at the top of the uk google search for "mole v4"!
haha!
Jammer
Going where everyone here has gone before!
|
|
|
|
|
Jammer,
Thanks for the comments on Mole. Currently working a version for Silverlight 2.
modified 27-Feb-21 21:01pm.
|
|
|
|