Beispiel #1
0
        /// <summary>
        /// Binds the tool bar to the given zoom and pan control.
        /// </summary>
        /// <param name="pControl">The control to bind.</param>
        public void BindToControl(AZoomAndPanControl pControl)
        {
            if (pControl != null)
            {
                this.mZoomAndPanControl = pControl;

                // Binding the ContentScale property.
                Binding lTextContentScaleBinding = new Binding("ContentScale");
                lTextContentScaleBinding.Source = this.mZoomAndPanControl;
                lTextContentScaleBinding.Converter = new ScaleToPercentConverter();
                lTextContentScaleBinding.StringFormat = "{0} %";
                this.mPercentTextBlock.SetBinding(TextBlock.TextProperty, lTextContentScaleBinding);

                Binding lValueContentScaleBinding = new Binding("ContentScale");
                lValueContentScaleBinding.Source = this.mZoomAndPanControl;
                lValueContentScaleBinding.Converter = new ScaleToPercentConverter();
                this.mZoomSlider.SetBinding(Slider.ValueProperty, lValueContentScaleBinding);

                this.mFillButton.Click += this.OnFillButtonClicked;
                this.mOneHundredPercentButton.Click += this.OnOneHundredPercentButtonClicked;
                this.mZoomOutButton.Click += this.OnZoomOutButtonClicked;
                this.mZoomInButton.Click += this.OnZoomInButtonClicked;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Binds the tool bar to the given zoom and pan control.
        /// </summary>
        /// <param name="pControl">The control to bind.</param>
        public void BindToControl(AZoomAndPanControl pControl)
        {
            if (pControl != null)
            {
                this.mZoomAndPanControl = pControl;

                // Binding the ContentScale property.
                Binding lTextContentScaleBinding = new Binding("ContentScale");
                lTextContentScaleBinding.Source       = this.mZoomAndPanControl;
                lTextContentScaleBinding.Converter    = new ScaleToPercentConverter();
                lTextContentScaleBinding.StringFormat = "{0} %";
                this.mPercentTextBlock.SetBinding(TextBlock.TextProperty, lTextContentScaleBinding);

                Binding lValueContentScaleBinding = new Binding("ContentScale");
                lValueContentScaleBinding.Source    = this.mZoomAndPanControl;
                lValueContentScaleBinding.Converter = new ScaleToPercentConverter();
                this.mZoomSlider.SetBinding(Slider.ValueProperty, lValueContentScaleBinding);

                this.mFillButton.Click += this.OnFillButtonClicked;
                this.mOneHundredPercentButton.Click += this.OnOneHundredPercentButtonClicked;
                this.mZoomOutButton.Click           += this.OnZoomOutButtonClicked;
                this.mZoomInButton.Click            += this.OnZoomInButtonClicked;
            }
        }