def __init__(self): self.Margin = Thickness(5) self.Background = SolidColorBrush(Colors.Green) self.create_headline() top_panel = ScrollViewer() top_panel.Height = 475 top_panel.Background = SolidColorBrush(Colors.White) top_panel.VerticalScrollBarVisibility = ScrollBarVisibility.Auto self.top_panel = top_panel border = Border() border.BorderThickness = Thickness(5) border.CornerRadius = CornerRadius(10) border.BorderBrush = SolidColorBrush(Colors.Blue) border.Background = SolidColorBrush(Colors.Yellow) border.Padding = Thickness(5) bottom_panel = StackPanel() bottom_panel.VerticalAlignment = VerticalAlignment.Stretch bottom_panel.HorizontalAlignment = HorizontalAlignment.Stretch bottom_panel.Background = SolidColorBrush(Colors.Red) bottom_panel.Orientation = Orientation.Horizontal border.Child = bottom_panel self.Children.Add(top_panel) self.Children.Add(border) self.bottom_panel = bottom_panel self.populate_login_panel()
def __init__(self, h): self.ctrl = Label() self.Initialize(h) self.image = Image() self.image.HorizontalAlignment = HorizontalAlignment.Center self.image.VerticalAlignment = VerticalAlignment.Center if h.get('image'): self.image.Source = BitmapImage( System.Uri(h['image'], System.UriKind.Relative)) if h.get('stretch'): self.Stretch(h['stretch']) else: self.StretchUniform() if h.get('size'): self.image.Height = float(h['size']) self.image.Width = float(h['size']) if h.get('scroll') and h['scroll']: scroll = ScrollViewer() scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto scroll.Content = self.image self.ctrl.Content = scroll elif h.get('multiple') and h['multiple']: stack = StackPanel() stack.Orientation = Orientation.Horizontal stack.Children.Add(self.image) self.ctrl.Content = stack else: self.ctrl.Content = self.image
def createScrollViewer(self, grid): scroll = ScrollViewer() scroll.Height = 200 scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto scroll.HorizontalAlignment = HorizontalAlignment.Stretch scroll.VerticalAlignment = VerticalAlignment.Stretch panel = StackPanel() text = TextBlock() text.TextWrapping = TextWrapping.Wrap text.Margin = Thickness(0, 0, 0, 20) text.Text = "A ScrollViewer.\r\n\r\nScrollbars appear as and when they are needed...\r\n" rect = Rectangle() rect.Fill = GetLinearGradientBrush() rect.Width = 500 rect.Height = 500 panel.Children.Add(text) panel.Children.Add(rect) scroll.Content = panel; SetGridChild(grid, scroll, 1, 2, "ScrollViewer")
import sys from System.Threading import Thread, ThreadStart from System.Windows import Application from System.Windows.Controls import ScrollViewer from utils import invoke, SetInvokeRoot root = Application.Current.LoadRootVisual(ScrollViewer(), "test.xaml") SetInvokeRoot(root) output = root.output class Writer(object): @invoke def write(self, data): output.Text += data root.ScrollToVerticalOffset(root.ScrollableHeight + root.ActualHeight) sys.stderr = sys.stdout = Writer() print 'Starting....' # must setup redirection before importing miniunit for # default streams to work print 'Importing test framework' import miniunit print 'Importing tests' from tests import test_storage loader = miniunit.TestLoader() runner = miniunit.TextTestRunner(verbosity=2)
def _showTextBlock(): sv = ScrollViewer() sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto sv.Content = _getTextBlock(rssItems) harriet.ChatWindow.RenderContent(sv)