protected override GeneralPathVisual CreateVisual(IRenderContext context, IStripe stripe) { IRectangle layout = stripe.Layout.ToRectD(); GeneralPath outline = CreatePath(stripe, layout); Brush brush = StripeDescriptor.BackgroundBrush; if (!(brush is SolidBrush)) { brush = NormalizeBrush(brush, layout); } return(new MyPathVisual(outline) { Transform = new Matrix(1, 0, 0, 1, (float)layout.X, (float)layout.Y), Brush = brush, Pen = new Pen(StripeDescriptor.BorderBrush, StripeDescriptor.BorderThickness), Size = layout.GetSize() }); }
protected override GeneralPathVisual UpdateVisual(IRenderContext context, GeneralPathVisual oldVisual, IStripe stripe) { var path = oldVisual as MyPathVisual; if (path == null) { return(CreateVisual(context, stripe)); } IRectangle layout = stripe.Layout.ToRectD(); if (path.Size != layout.GetSize()) { // the size has changed: need to recreate the path path.Path = CreatePath(stripe, layout); } path.Brush = StripeDescriptor.BackgroundBrush is SolidBrush ? StripeDescriptor.BackgroundBrush : NormalizeBrush(StripeDescriptor.BackgroundBrush, layout); path.Transform = new Matrix(1, 0, 0, 1, (float)layout.X, (float)layout.Y); return(path); }