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 8409461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:55:02+00:00 2026-06-09T23:55:02+00:00

Looking to learn a way to clean up this code. Is there any way

  • 0

Looking to learn a way to clean up this code. Is there any way to apply a defined “style” in c#? I am new and looking for ways to tighten up my programming. I would like to be able to define the margin, maximum value, orientation, step frequency, tick frequency, tick placement, and transitions to each slider in a more concise way.

        //Slider 1
        Slider Slider_1 = new Slider();
        Slider_1.SetValue(Grid.ColumnProperty, 0);
        Slider_1.Margin = new Thickness(30, 12, 0, 0);
        Slider_1.Orientation = Orientation.Vertical;
        Slider_1.Maximum = 10;
        Slider_1.StepFrequency = 0.25;
        Slider_1.TickFrequency = 0.25;
        Slider_1.TickPlacement = TickPlacement.Outside;
        Slider_1.Transitions = new TransitionCollection();
        Slider_1.Transitions.Add(new EntranceThemeTransition() { });

        //Slider 2
        Slider Slider_2 = new Slider();
        Slider_2.SetValue(Grid.ColumnProperty, 1);
        Slider_2.Margin = new Thickness(30, 12, 0, 0);
        Slider_2.Orientation = Orientation.Vertical;
        Slider_2.Maximum = 10;
        Slider_2.StepFrequency = 0.25;
        Slider_2.TickFrequency = 0.25;
        Slider_2.TickPlacement = TickPlacement.Outside;
        Slider_2.Transitions = new TransitionCollection();
        Slider_2.Transitions.Add(new EntranceThemeTransition() { });

        //Slider 3
        Slider Slider_3 = new Slider();
        Slider_3.SetValue(Grid.ColumnProperty, 2);
        Slider_3.Margin = new Thickness(30, 12, 0, 0);
        Slider_3.Orientation = Orientation.Vertical;
        Slider_3.Maximum = 10;
        Slider_3.StepFrequency = 0.25;
        Slider_3.TickFrequency = 0.25;
        Slider_3.TickPlacement = TickPlacement.Outside;
        Slider_3.Transitions = new TransitionCollection();
        Slider_3.Transitions.Add(new EntranceThemeTransition() { });

        //Slider 4
        Slider Slider_4 = new Slider();
        Slider_4.SetValue(Grid.ColumnProperty, 3);
        Slider_4.Margin = new Thickness(30, 12, 0, 0);
        Slider_4.Orientation = Orientation.Vertical;
        Slider_4.Maximum = 10;
        Slider_4.StepFrequency = 0.25;
        Slider_4.TickFrequency = 0.25;
        Slider_4.TickPlacement = TickPlacement.Outside;
        Slider_4.Transitions = new TransitionCollection();
        Slider_4.Transitions.Add(new EntranceThemeTransition() { });
  • 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-09T23:55:04+00:00Added an answer on June 9, 2026 at 11:55 pm
    Slider Slider_1 = new Slider(); 
    SetProperties(Slider_1,.....)
    
    
    public void SetProperties(Slider slider,some other parameters)
    {
        slider.SetValue(Grid.ColumnProperty, 0);
        slider.Margin = new Thickness(30, 12, 0, 0);
        slider.Orientation = Orientation.Vertical;
        slider.Maximum = 10;
        slider.StepFrequency = 0.25;
        slider.TickFrequency = 0.25;
        slider.TickPlacement = TickPlacement.Outside;
        slider.Transitions = new TransitionCollection();
        slider.Transitions.Add(new EntranceThemeTransition() { });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think that looking at others' code is a good way to learn. I'm
I've been looking for ways to learn about the right way to manage a
I was pondering (and therefore am looking for a way to learn this, and
Currently looking into learn new technology and silverlight is on the potential list. However,
Looking at this question the OWASP WebGoat project looks like a great way to
I have no idea if this is possible but is there a way in
So, I've been trying to clean up my code and learn things that I
Minor quest - looking for a clean way to dynamically set the size of
I have started looking at the project Euler site as a way to learn
I'm a long time windows developer looking to learn something about Android programming. I'm

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.