I was trolling the Xamarin.Forms forum when I saw this question:

Can you limit a Slider to only allow integer values? (Hopefully snapping to the next integer)

I dug around a bit I found this solution on StackOverflow.  I did a quick and dirty conversion to Xamarin.Forms, but wanted to make it a little better, more Xamarin.Formy.

So, here is the answer to this question:

 

ExtendedSlider Class

The first thing we need to do is create a new Slider class that has our “stop” value, which we do using the following code:

public class ExtendedSlider : Slider
{
    public static readonly BindableProperty CurrentStepValueProperty = 
           BindableProperty.Create<ExtendedSlider, double>(p => p.StepValue, 1.0f);

    public double StepValue
    {
        get { return (double)GetValue(CurrentStepValueProperty); }

        set { SetValue(CurrentStepValueProperty, value); }
    }

    public ExtendedSlider()
    {
        ValueChanged += OnSliderValueChanged;
    }

    private void OnSliderValueChanged(object sender, ValueChangedEventArgs e)
    {
        var newStep = Math.Round(e.NewValue / StepValue);

        Value = newStep * StepValue;
    }
}

All this really does is converts the current slider value from a double, into an integer.

 

Demonstration Page

Here is a fully functional demonstration page:

public class SliderDemo : ContentPage
{
    public SliderDemo()
    {
        var sliderMain = new ExtendedSlider
        {
            Minimum = 0.0f,
            Maximum = 5.0f,
            Value = 0.0f,
            StepValue = 1.0f,
            HorizontalOptions = LayoutOptions.FillAndExpand,
        };

        var labelCurrentValue = new Label
        {
            HorizontalOptions = LayoutOptions.CenterAndExpand,
            BindingContext = sliderMain,
        };

        labelCurrentValue.SetBinding(Label.TextProperty, 
                                        new Binding("Value", BindingMode.OneWay, 
                                            null, null, "Current Value: {0}"));

        var grid = new Grid
        {
            Padding = 10,
            RowDefinitions =
            {
                new RowDefinition {Height = GridLength.Auto},
            },
            ColumnDefinitions =
            {
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
            },
        };

        for (var i = 0; i < 6; i++)
        {
            var label = new Label
            {
                Text = i.ToString(CultureInfo.InvariantCulture),
            };

            var tapValue = i; // Prevent modified closure

            label.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => { sliderMain.Value = tapValue; }),
                NumberOfTapsRequired = 1
            });

            grid.Children.Add(label, i, 0);
        }

        Content = new StackLayout
        {
            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 10),
            Children = { grid, sliderMain, labelCurrentValue },
            Orientation = StackOrientation.Vertical,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.FillAndExpand
        };
    }
}

If anyone has a better way of doing this, then please let me know.

I’ll probably add this to the Xamarin.Forms Labs project sometime this week.

,

I am holding another Dynamics CRM Plugin Development workshop next month. The goal of the class is for me to teach you everything I know about plugin development.

When:

Monday, September 15th through Thursday, September 18th. 1:00pm – 5:00pm CST each day.

 

Where:

Online using GoTo Meeting

 

What:

This is a hands-on workshop with each student provided their own virtual development environment for the duration of the class

 

Cost:

$895 per person (multi-student discounts available)

Note: Due to the interactive nature of this workshop, it will be limited to 10 students.

Eventbrite - Plug-in Development with Dynamics CRM (September)

 

Agenda:

  • Plugin architecture and design
    • The Dynamics CRM execution pipeline
    • The how, why, and where of plugging into Dynamics CRM
    • Performance considerations
    • Working in the sandbox
  • The development environment
    • Setup
    • Source control
    • Working in teams
  • Deploying plugins
    • To CRM
    • In a solution
    • To CRM Online (if applicable to the student population)
  • Debugging plugins
    • Synchronous vs. asynchronous
    • Full-trust vs. sandboxed
  • Custom activity architecture
  • Design features
  • Deployment
  • Asynchronous process monitoring
  • System job cleanup and maintenance
  • Open-lab time
  • Upgrade scenarios
  • Code-recovery of lost source plugin code

Thanks to our virtual development environments, the majority of our time will be spent actually designing and developing real-world plugins. Think labs. Lots and lots of labs.

Students will also be asked to bring one project with them that they would like to create while additional resources are available to them. This is strictly optional, but it is available.

In addition to the workshop materials, each student will receive additional tools and code templates to help increase their productivity as a Dynamics CRM plugin developer.

Finally, all students are free to keep any work produced during their lab-time as well as the tools and templates used in class.

Eventbrite - Plug-in Development with Dynamics CRM (September)

I am very excited to announce that my workshop on Dynamics CRM JavaScript Development is now ready. The goal of the class is for me to give you a very thorough introduction to using JavaScript within Dynamics CRM.

When:

Monday, September 8th through Thursday, September 11th. 1:00pm-5:00pm each day.

Where:

Online using GoTo Meeting.

What:

This is a hands-on workshop with each student provided their own virtual development environment for the duration of the class.

Cost:

$895 per person (multi-student discounts available)

Note: Due to the interactive nature of this workshop, it will be limited to 10 students.

 

Eventbrite - JavaScript Development with Dynamics CRM (September)

 

Student Prerequisite Knowledge:

  • Each student must have working knowledge of Dynamics CRM 2011.
  • Knowledge of JavaScript is also required.

Note: For those students that have not worked with JavaScript previously, a short introduction webinar will be conducted the week of September 1st (actual date TBD). Students attending this webinar will be expected to have completed the accompanying self-study materials before Monday's class begins. Everyone must be ready to run on Monday for the main class.

Agenda:

Each classroom day will run from 1:00pm to 5:00pm (CST) with the virtual environments available for student use until midnight of September 4th.

And thanks to our virtual development environments, the majority of our time will be spent actually developing JavaScript solutions for Dynamics CRM.

Think labs. Lots and lots of labs. And homework. There will be homework.

We'll cover the following topics:

  • Creating a development environment
    • Setup
    • Source control
    • Working in teams
    • Working with Visual Studio
  • Working with Web Resources
  • Working with Solutions
  • Working with Forms
    • JavaScript libraries
    • Form events
    • Form Event Handler Execution Context Reference
  • Working with the Xrm.Page Object Model
    • Working with Collections
    • Data operations
    • Tabs and Sections
    • Working with Controls
    • Working with iFrames
    • Working with Navigation Items
  • Ribbon button and JavaScript connection
  • Opening Dynamics CRM Forms and Web Resources via JavaScript
  • Using the XrmSrcToolkit to CRM-related data operations

We will be using about 75 of the methods found in the Xrm.Page object model so you should leave class with a fairly good understanding of where things are and how to access them.

If we have time, we will also cover some of the freely available JavaScript components that can be used to aid in your development efforts and to increase your user's productivity.

Students will also receive a draft copy of my upcoming book on Dynamics CRM JavaScript development along with sample code and utility web resources that should help you kick start your CRM JavaScript development efforts.

Please email me if you have any questions: mitch at crmaccelerators dot net

Eventbrite - JavaScript Development with Dynamics CRM (September)

Hey everyone, I am rolling off a long-term gig in California and am looking for new projects.

Give me a shout if you’ve got some interesting Dynamics CRM development or architecture underway.

Thanks, Mitch

So I am coming out of stealth-mode to announce what I think we all can agree is a “game changing application,” that runs across iOS, Android, and Windows Phone.

 

Announcing Beer:30

 

Default@2x

I had planned to submit Beer:30 for this year’s Xammy Awards but I just didn’t have time to finish all of the bells and whistles I have planned.  So, this is my non-entry.

I just wanted to other contestants how close they came to being a no-show since I surely would have won multiple Xammy categories.

So, without further ado, here is why Beer:30 will be the breakthrough application of 2014:

 

Beer:30 is Transformative

The sole purpose of Beer:30 is to tell you where in the world it is 5:00pm, what kinds of beer are probably being consumed, and otherwise give you that smallest of excuses as to why you should leave work early.  Transformational? You bet!

 

Beer:30 is Innovative

NDA. Sorry.

 

Beer:30 is Revolutionary

Think about it.  Beer: The fuel of revolutions.  Now at your fingertips.  What is not to love about that?

 

Beer:30 is Versatile

As @JosephHill mentioned, it is indeed a BYOB world out there and one must come prepared.  Who knows, today Beer:30 is on your phone; tomorrow it could be powering off your work computer and preprogramming you in-car navigation system to deliver you to your favorite pub.  The possibilities are endless.

Note: These are examples only!  Please do not ask us about future developments. Those are still under NDA…

 

Beer:30 is Descriptive

Now this is where it get’s really scary.  So I have been working on Beer:30, off and on, on the iOS platform for about 5 years.  I think.  Actually, I have no idea, but a long time.  And yes, I know, that is a long time, but perfection cannot be rushed.  That and the fact that time zone calculations are horrible.

Anyway, a couple of weeks ago, I converted the whole damn thing to Xamarin.Forms in about an hour.  This is including research time to find a really cool PCL-based date library that would work across platforms.

 

In Conclusion

So that is about it folks.  Stay tuned and hopefully my perfectionism and product schedule will coincide and I will have Beer:30 finished in time for Evolve 2014.

See you in Atlanta!

,

Hi Everyone,

As was described in this week’s webinar, I’m holding the first Becoming a Dynamics CRM Technical Architect class starting at the end of this month.

Here are the specifics of the class:

 

Overview:

  • Six week duration
  • Two sessions per week
  • Two hours each session
  • Limited to 20 students
  • Cost: $2,495

Schedule:

Week Tuesday Thursday
1 August 26th August 28th
2 September, 2th September, 4th
3 September, 9th September, 11th
4 September, 16th September, 18th
5 September, 23rd September, 25th
6 September 30th October 2nd

Agenda:

  • Week 1: Dynamics CRM tools and technologies
  • Week 2: Feature–based scenarios
  • Week 3: Feature–based scenarios
  • Week 4: Feature–based scenarios
  • Week 5: Case study and system design (Scenario #1)
  • Week 6: Case study and system design (Scenario #2)

 

If you are interested in attending the Becoming a Dynamics CRM Architect class, which starts later this month, then please complete the following survey: 

http://www.xrmcoaches.com/becoming-a-crm-architect-class

Students will be selected on a first-come, first-served basis.  I am giving the webinar attendees first access.  The general announcement will be made tomorrow.

If you have any questions or comments, please let me know.

Thanks, Mitch

Hi Everyone,

On Tuesday, August 5th, I’ll be holding a free webinar to discuss the requirements for a person to make the move from being a Dynamics CRM user, administrator, or developer, into becoming an architect of Dynamics CRM business solutions.

Over the past year or so, I have been slowly assembling a class that would teach people to think and act like solution architects.  This will be the first public visibility into the process.

I am using this free preview to gather feedback and opinions about the direction I am taking, while I still have time to make changes to the processes and curriculum.

 

What to expect

In this webinar we will be discussing the basic technical areas of expertise and skillsets that must be developed on your path to becoming an architect.  In part, if not in full.

We will also be reviewing several CRM-related design scenarios which will highlight the types of things you need to consider when developing solutions for Dynamics CRM.

At minimum, I would expect you to come out of the webinar with at least a basic understanding of the types of questions that must be asked when designing Dynamics CRM-related solutions.

 

What I can use your help with

Feedback during the webinar will, of course, be accepted.  In addition, I will send out a survey afterwards to help gather additional data points.

 

Who should attend?

Anyone who would like to further their knowledge related to solving business problems using Microsoft Dynamics CRM.

 

Requirements

You must have working knowledge of Microsoft Dynamics CRM 4.0, 2011, or 2013. This is neither an Introduction to Microsoft Dynamics CRM or a development class, but you do need to know the capabilities of the product.

 

Sessions

I am actually holding three sessions to accommodate attendees from around the world:

 

Session 1: UTC+1

Tue, Aug 5, 2014 8:00 AM – 9:30 AM CDT

https://www4.gotomeeting.com/register/586154887

 

Session 2: UTC-5

Tue, Aug 5, 2014 1:00 PM – 2:30 PM CDT

https://www4.gotomeeting.com/register/821765311

 

Session 3: UTC+10

Tue, Aug 5, 2014 7:00 PM – 8:30 PM CDT

(this translates to 10:00am, Wednesday, August 6th, in Sydney, AU)

https://www4.gotomeeting.com/register/163590623

Hi Everyone,

To say the response to next week’s webinar was overwhelming would be putting it lightly:  I have attendees from 14 countries, spread around the globe.

Given such response, I have decided to add two new sessions to the webinar schedule for next week. This should:

  1. Help with time zone issues and to keep people from having to wake up in the middle of the night to attend.
  2. Give us a more intimate environment where everyone feels comfortable participating.

But wait, there’s more: I’ve also lengthened the webinar to 1.5 hours so that we have time for proper Q&A.

Here are the new sessions:

Session 1: UTC+1

Tue, Aug 5, 2014 8:00 AM – 9:30 AM CDT

https://www4.gotomeeting.com/register/586154887

 

Session 2: Original Session and Time

Tue, Aug 5, 2014 1:00 PM – 2:30 PM CDT

https://www4.gotomeeting.com/register/821765311

 

Session 3: UTC+10

Tue, Aug 5, 2014 7:00 PM – 8:30 PM CDT

(this translates to 10:00am, Wednesday, August 6th, in Sydney, AU)

https://www4.gotomeeting.com/register/163590623

 

If you wish to remain in the original session, then take no action. Should you wish to attend one of the new sessions, just click on the appropriate registration link above. Unfortunately, I have no way of automatically moving you from one webinar to another so you will need to repeat the sign–up process. I apologize for this inconvenience.

I will perform a data–cleanse over the weekend and remove anyone from the original session who has signed up for one of the new sessions to hopefully keep you from being bombarded by incorrect announcement emails.

Again, thank you for your interest and we’ll be talking next week!

Mitch

Hi Everyone,

On Tuesday, August 5th, I’ll be holding a free webinar to discuss the requirements for a person to make the move from being a Dynamics CRM user, administrator, or developer, into becoming an architect of Dynamics CRM business solutions.

Over the past year or so, I have been slowly assembling a class that would teach people to think and act like solution architects.  This will be the first public visibility into the process.

I am using this free preview to gather feedback and opinions about the direction I am taking, while I still have time to make changes to the processes and curriculum.

 

What to expect

In this webinar we will be discussing the basic technical areas of expertise and skillsets that must be developed on your path to becoming an architect.  In part, if not in full.

We will also be reviewing several CRM-related design scenarios which will highlight the types of things you need to consider when developing solutions for Dynamics CRM.

At minimum, I would expect you to come out of the webinar with at least a basic understanding of the types of questions that must be asked when designing Dynamics CRM-related solutions.

 

What I can use your help with

Feedback during the webinar will, of course, be accepted.  In addition, I will send out a survey afterwards to help gather additional data points.

 

Who should attend?

Anyone who would like to further their knowledge related to solving business problems using Microsoft Dynamics CRM.

 

Requirements.

You must have working knowledge of Microsoft Dynamics CRM 4.0, 2011, or 2013. This is neither an Introduction to Microsoft Dynamics CRM or development class, but you do need to know the capabilities of the product.

 

Please let me know if you have any questions or comments.

Thanks, Mitch

 

Space is limited.
Reserve your Webinar seat now at:
https://www4.gotomeeting.com/register/821765311

Title:

Becoming an Dynamics CRM Technical Architect

Date:

Tuesday, August 5, 2014

Time:

1:00 PM – 2:00 PM CDT

After registering you will receive a confirmation email containing information about joining the Webinar.

System Requirements
PC-based attendees
Required: Windows® 8, 7, Vista, XP or 2003 Server

Mac®-based attendees
Required: Mac OS® X 10.6 or newer

Mobile attendees
Required: iPhone®, iPad®, Android™ phone or Android tablet

Hi Everyone,

I just wanted to remind you that registration for the Extending Microsoft Dynamics CRM 2013 workshop ends on Thursday, July 17th at 10:00am CDT.

For more information about this workshop, please review the following:

http://www.infinite-x.net/2014/07/01/extending-dynamics-crm-2013-workshop

http://www.infinite-x.net/2014/07/08/why-you-should-be-attending-the-extending-dynamics-crm-workshop

When you’re ready to register, just click this button:

Eventbrite - Extending Dynamics CRM 2013

 

Thanks and I’ll be talking to some of you next week.

Mitch

Sign up for our new KnowledgeBits service and get news, tips and tricks and more, delivered straight to your inbox.