protected override void DrawContent(DrawingContext drawingContext) { //MyBase.OnRender(drawingContext) if (ActualWidth <= 0 || ActualHeight <= 0) { return; } Brush brush; Brush borderbrush; if (!IsEnabled) { brush = sStyle.BackDisabledBrush; borderbrush = sStyle.BorderDisabledBrush; } else if (MouseOver | pressedState == MouseStates.WindowPressed) { brush = sStyle.BackMouseoverBrush; borderbrush = sStyle.BorderMouseoverBrush; } else { brush = sStyle.BackNormalBrush; borderbrush = sStyle.BorderBrush; } drawingContext.DrawRectangle(brush, null, new Rect(0, 0, ActualWidth, ActualHeight)); drawingContext.DrawLine(new Pen(borderbrush, sStyle.BaseBorderThickness.Left), new Point(0.5, 0.5), new Point(0.5, ActualHeight - 0.5)); drawingContext.DrawLine(new Pen(borderbrush, sStyle.BaseBorderThickness.Top), new Point(0.5, 0.5), new Point(GetSW(false), 0.5)); drawingContext.DrawLine(new Pen(borderbrush, sStyle.BaseBorderThickness.Right), new Point(GetSW(false), 0.5), new Point(GetSW(false), ActualHeight - 0.5)); drawingContext.DrawLine(new Pen(borderbrush, sStyle.BaseBorderThickness.Bottom), new Point(0.5, ActualHeight - 0.5), new Point(GetSW(false), ActualHeight - 0.5)); DrawScrollbar(drawingContext); if (controller.VisibleCount < 1) { return; } // Actual loop for drawing list items for (var i = LowIndex; i <= Math.Min(HighIndex, controller.VisibleCount - 1); i++) { brush = getBrush(i, drawingContext, brush); DrawText(i, drawingContext, brush); } //' Draws to line where DragTo points if (dragTo >= lowIndex && dragTo <= highIndex) { if (dragTo < controller.GetSelectedIndex()) { drawingContext.DrawLine(new Pen(sStyle.PressedBrush, 1), new Point(0, (dragTo - LowIndex) * sStyle.RowHeight + 3), new Point(GetSW(), (dragTo - LowIndex) * sStyle.RowHeight + 3)); } else { drawingContext.DrawLine(new Pen(sStyle.PressedBrush, 1), new Point(0, (dragTo - LowIndex + 1) * sStyle.RowHeight + 3), new Point(GetSW(), (dragTo - LowIndex + 1) * sStyle.RowHeight + 3)); } } }