Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:30:12+00:00 2026-06-03T22:30:12+00:00

I have this WPF slider: <Slider Height=22 HorizontalAlignment=Left Width=100 TickPlacement=BottomRight AutoToolTipPlacement=BottomRight TickFrequency=1 Minimum=10 Maximum=110

  • 0

I have this WPF slider:

<Slider Height="22" HorizontalAlignment="Left" Width="100" TickPlacement="BottomRight" AutoToolTipPlacement="BottomRight" TickFrequency="1" Minimum="10" Maximum="110" Value="{Binding Path=Zoom, Mode=TwoWay}" Ticks="100"/>

and my c# code behind

public object Zoom
{
    get { return _zoom.ToString() }
    set
    {
        try
        {
            string zoom = value.ToString().Replace(",", ".");
            if (zoom.EndsWith(" %"))
            {
                _zoom= System.Convert.ToInt32(System.Convert.ToInt64(zoom));
            }
            OnPropertyChanged("CurrentZoom");
        }
        catch (FormatException ex)
        {
            //TODO: =)
        }
    }
}

how is it possible that only integers can be stored in _zoom? I don’t need a decimal number.

for example:

zoom is “13,99999”

_zoom should be 13 (int)

_zoom= System.Convert.ToInt32(System.Convert.ToInt64(zoom));

so i get this error:

Value was either too large or too small for an Int32.

whats wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:30:12+00:00Added an answer on June 3, 2026 at 10:30 pm
    _zoom = (int)Math.Round(System.Convert.ToDouble(zoom));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code for a slider control in WPF: occuranceTimeSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight;
I have this code: <ComboBox Width=100 ItemsSource={Binding FontList} x:Name=fontComboFast> <ComboBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel /> </ItemsPanelTemplate>
So I have this WPF style: <Style x:Key=SmallLinkButton TargetType=Button> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType=Button>
So, I have this desktop app built using WPF and C#. It's basically an
The CollectionViewSource.GetDefaultView() method is not in Silverlight 3. In WPF I have this extension
In my WPF application I have some drawing functionality. I have solved this using
I have a WPF UserControl with binding converters referenced like this: <UserControl x:Class=MyControl x:Name=MyControl
I have a WPF user control with a number of textboxes, this is hosted
I have a simple WPF application that uses ClickOnce to handle installing. Within this
This question is related to a WPF application. I have a class as below

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.