Ejemplo n.º 1
0
        private void AppendButtonToNumberPanelList(int pageNumber, int numberOfPages)
        {
            Button button = new Button();

            button.Content = pageNumber;
            button.Click  += (sender, args) =>
            {
                var button = sender as Button;
                if (button != null)
                {
                    int unboxedValue = (int)button.Content;
                    SelectedPageIndex = unboxedValue - 1;
                }
            };
            // Set the default style of buttons
            button.Style = (Style)ResourceAccessor.ResourceLookup(this, c_numberPanelButtonStyleName);
            AutomationProperties.SetName(button, ResourceAccessor.GetLocalizedStringResource(ResourceAccessor.SR_PagerControlPageTextName) + " " + pageNumber);
            AutomationProperties.SetPositionInSet(button, pageNumber);
            AutomationProperties.SetSizeOfSet(button, numberOfPages);
            m_numberPanelElements.Add(button);
        }