def AddItem(self, item, width=1, expand=False, border=False): if expand: length = GridLength(width, GridUnitType.Star) else: length = GridLength(width, GridUnitType.Auto) self.ctrl.ColumnDefinitions.Add(ColumnDefinition(Width=length)) Grid.SetColumn(item, self.cols) if border: rect = Rectangle() rect.Stroke = Brushes.Gray rect.Fill = Brushes.Transparent Grid.SetColumn(rect, self.cols) self.ctrl.Children.Add(rect) self.ctrl.Children.Add(item) self.cols = self.cols + 1
def AddItem(self, item, height=1, expand=False, border=False): if expand: length = GridLength(height, GridUnitType.Star) else: length = GridLength(height, GridUnitType.Auto) self.ctrl.RowDefinitions.Add(RowDefinition(Height=length)) Grid.SetRow(item, self.rows) if border: rect = Rectangle() rect.Stroke = Brushes.Gray rect.Fill = Brushes.Transparent Grid.SetRow(rect, self.rows) self.ctrl.Children.Add(rect) self.ctrl.Children.Add(item) self.rows = self.rows + 1
def AddItem(self,item,attr=None,width=1): if attr and attr.get('expand'): length = GridLength(width, GridUnitType.Star) else: length = GridLength(width, GridUnitType.Auto) self.ctrl.ColumnDefinitions.Add(ColumnDefinition(Width = length)) Grid.SetColumn(item, self.cols); if attr and attr.get('group'): group = GroupBox() group.Header = attr['group'] group.AddChild(item) Grid.SetColumn(group, self.cols); self.ctrl.Children.Add(group) else: if attr and attr.get('border') and attr['border']: rect = Rectangle() rect.Stroke = Brushes.Gray rect.Fill = Brushes.Transparent Grid.SetColumn(rect, self.cols); self.ctrl.Children.Add(rect) self.ctrl.Children.Add(item) self.cols = self.cols + 1
def AddItem(self,item,attr=None,height=1): if attr and attr.get('expand'): length = GridLength(height, GridUnitType.Star) else: length = GridLength(height, GridUnitType.Auto) self.ctrl.RowDefinitions.Add(RowDefinition(Height = length)) Grid.SetRow(item, self.rows); if attr and attr.get('group'): group = GroupBox() group.Header = attr['group'] group.AddChild(item) Grid.SetRow(group, self.rows); self.ctrl.Children.Add(group) else: if attr and attr.get('border') and attr['border']: rect = Rectangle() rect.Stroke = Brushes.Gray rect.Fill = Brushes.Transparent Grid.SetRow(rect, self.rows); self.ctrl.Children.Add(rect) self.ctrl.Children.Add(item) self.rows = self.rows + 1