I would convert the text below (c#) in IronPython. I need create a DrawingVisual and I must override the VisualChildrenCount property and the GetVisualChild method.
source: official web Microsoft
// Provide a required override for the VisualChildrenCount property. protected override int VisualChildrenCount { get { return _children.Count; } } // Provide a required override for the GetVisualChild method. protected override Visual GetVisualChild(int index) { if (index < 0 || index >= _children.Count) { throw new ArgumentOutOfRangeException(); } return _children[index]; }
class MyVisualHost(FrameworkElement): def __init__(self, drawingVisual): self._children = VisualCollection(self) self._children.Add(drawingVisual) self.VisualChildrenCount = self._children.Count def GetVisualChild(self, index): try: if (index <= 0) or (index >= _children.Count): System.ArgumentOutOfRangeException() else: return _children[index] except: pass myVisualHost = MyVisualHost(drawingVisual)
Message:Expected property for VisualChildrenCount, but found int.
Any suggestions?, thanks
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)