Click here to Skip to main content
15,908,909 members
Home / Discussions / WPF
   

WPF

 
QuestionMultiple views Pin
Jozef Hopko19-Nov-08 0:00
Jozef Hopko19-Nov-08 0:00 
AnswerRe: Multiple views Pin
Gideon Engelberth19-Nov-08 3:25
Gideon Engelberth19-Nov-08 3:25 
GeneralRe: Multiple views Pin
Jozef Hopko19-Nov-08 11:52
Jozef Hopko19-Nov-08 11:52 
GeneralRe: Multiple views Pin
ColinM12319-Nov-08 17:40
ColinM12319-Nov-08 17:40 
QuestionCheckedComboBox Control in WPF Pin
aruna_koride18-Nov-08 16:18
aruna_koride18-Nov-08 16:18 
QuestionSilverLIght Initialization Error Pin
abeesmuhammed17-Nov-08 19:10
abeesmuhammed17-Nov-08 19:10 
AnswerRe: SilverLIght Initialization Error Pin
Ravi Bhavnani26-Nov-08 12:43
professionalRavi Bhavnani26-Nov-08 12:43 
QuestionWPF faster DrawingVisuals initialization. Pin
Polykar17-Nov-08 2:01
Polykar17-Nov-08 2:01 
Hello,
We are planning to migrate to WPF. For a few use cases, drawingspeed is an issue. Drawing 10'000 mostly static lines on a zoomable/panable canvas is about as much as I need. Using DrawingVisuals, the performance is not acceptable, because the initialization takes around 10 seconds (which is ridiculous). After the initalization, the paning/zooming works fine. Please have a look at my sample code and tell me which part is terribly wrong...

Pen pen = new Pen(Brushes.Red, 5);
Random random = new Random();

DrawingVisual visual = new DrawingVisual();
using (DrawingContext dc = visual.RenderOpen())
{
    for (int i = 0; i < 10000; i++)
    {
        Point p1 = new Point(random.Next(0, 5000), random.Next(0, 5000));
        Point p2 = new Point(random.Next(0, 100), random.Next(0, 100));
        dc.DrawLine(pen, p1, new Point(p1.X - p2.X, p1.Y - p2.Y));
    }
    dc.Close();
}
MyCanvas.AddVisual(visual);


where MyCanvas is an overload of Canvas

using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Media;

namespace WpfApplication1
{
    public class DrawingCanvas : Canvas
    {
        private List<visual> _visuals = new List<visual>();

        protected override int VisualChildrenCount
        {
            get
            {
                return _visuals.Count;
            }
        }

        protected override Visual GetVisualChild(int index)
        {
            return _visuals[index];
        }

        public void AddVisual(Visual visual)
        {
            _visuals.Add(visual);
            base.AddVisualChild(visual);
            base.AddLogicalChild(visual);
        }
    }
}
</visual></visual>



thanks a lot.
regards.
mike.
AnswerRe: WPF faster DrawingVisuals initialization. Pin
lneir17-Nov-08 19:48
lneir17-Nov-08 19:48 
GeneralRe: WPF faster DrawingVisuals initialization. Pin
Polykar17-Nov-08 20:54
Polykar17-Nov-08 20:54 
QuestionGet element positions Pin
Not Active16-Nov-08 18:33
mentorNot Active16-Nov-08 18:33 
AnswerRe: Get element positions Pin
Michael Sync16-Nov-08 18:57
Michael Sync16-Nov-08 18:57 
GeneralRe: Get element positions Pin
Not Active16-Nov-08 18:59
mentorNot Active16-Nov-08 18:59 
GeneralLearning WPF Pin
ColinM12316-Nov-08 11:11
ColinM12316-Nov-08 11:11 
GeneralRe: Learning WPF Pin
Pete O'Hanlon16-Nov-08 11:18
mvePete O'Hanlon16-Nov-08 11:18 
QuestionDataGrid Pin
VisualLive16-Nov-08 5:33
VisualLive16-Nov-08 5:33 
QuestionAdvanced masking - Interlacing 3 video inputs into a single image [modified] Pin
Graeme_Grant16-Nov-08 2:14
mvaGraeme_Grant16-Nov-08 2:14 
AnswerRe: Advanced masking - Interlacing 3 video inputs into a single image Pin
Insincere Dave16-Nov-08 8:57
Insincere Dave16-Nov-08 8:57 
GeneralRe: Advanced masking - Interlacing 3 video inputs into a single image Pin
Graeme_Grant16-Nov-08 9:39
mvaGraeme_Grant16-Nov-08 9:39 
GeneralRe: Advanced masking - Interlacing 3 video inputs into a single image Pin
Insincere Dave18-Nov-08 5:56
Insincere Dave18-Nov-08 5:56 
GeneralRe: Advanced masking - Interlacing 3 video inputs into a single image [modified] Pin
Graeme_Grant19-Nov-08 1:35
mvaGraeme_Grant19-Nov-08 1:35 
QuestionWPF Binding to an attached property from a DataTemplate [modified] Pin
Mark Salsbery14-Nov-08 13:13
Mark Salsbery14-Nov-08 13:13 
AnswerRe: WPF Binding to an attached property from a DataTemplate Pin
Timmy Kokke14-Nov-08 13:46
Timmy Kokke14-Nov-08 13:46 
GeneralRe: WPF Binding to an attached property from a DataTemplate Pin
Mark Salsbery14-Nov-08 14:20
Mark Salsbery14-Nov-08 14:20 
GeneralRe: WPF Binding to an attached property from a DataTemplate Pin
Timmy Kokke14-Nov-08 22:10
Timmy Kokke14-Nov-08 22:10 

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.