Ejemplo n.º 1
0
def add_stackpanel(document, items):
    panel = StackPanel()
    document.Children.Add(panel)
    panel.Margin = Thickness(10)
    for i, item in enumerate(items):
        item_panel = StackPanel()
        item_panel.Margin = Thickness(2)
        item_panel.Orientation = Orientation.Horizontal
        panel.Children.Add(item_panel)

        text = _get_text_block(u'\u2022\u00a0')
        item_panel.Children.Add(text)

        def goto_page(s, e, page=i + 1):
            _debug('goto', page)
            if topComboBoxPart.SelectedIndex == 0:
                topComboBoxPart.SelectedIndex = page
            else:
                topComboBoxPage.SelectedIndex = page

        button = HyperlinkButton()
        item_panel.Children.Add(button)
        button.Content = _get_text_block(item)
        button.Click += goto_page