This project has moved and is read-only. For the latest updates, please go here.

IntegerUpDown Question

Oct 24, 2011 at 8:44 PM

Hi,

I am using a number of integerUpDowns. I use them to set some ranges that the application will run through.

So they have Minimum and Maximum values set.

The user would like a feature to reset values, both min and max to 0.

So when I reset to 0, IntUpdown will go to its min value, which might not be 0.

If I had set the min to say 500 in xaml, if I set the min property to 0, it will go to 500.

Wondering there is a way to override this without ruining the min max settings that I have in there.

This is an mvvm app so I am using properties.

Thanks

Jeff

Oct 24, 2011 at 8:49 PM

I do not completely understand what you are trying to accomplish.  You could always create your own control that inherits from the IntegerUpDown and add the required functionality.

Oct 24, 2011 at 9:19 PM

Hi,
I probably should have posted some code.
So here is the xaml for one the the updowns. I want the range to be within 3000 - 7000.
The user would like a button that resets this minimum to 0, would display the 0 in the updown, not replace the min.


<extToolkit:IntegerUpDown Name="intUpRpmMax" HorizontalAlignment="Right" VerticalAlignment="Center"
Value="{Binding Path=MaxRpm, ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Path=RpmEnabled, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
Margin="0,170,735,428" Maximum="7000" Minimum="3000" Width="60" Increment="50" />


Below is the property, when I set it to 0, like so, MaxRpm = "0";
The upDown actually displays 3000 rather then 0, the min as set in the xaml. But I just want to reset the displayed value to 0, when the portion of the code that uses the 3000 is not actually running.

Thanks for the quick response,
Jeff

public string MaxRpm
{
get
{
return dataManager.SensorData.RpmMax;
}

set
{
if (value == dataManager.SensorData.RpmMax || String.IsNullOrEmpty(value))
return;

dataManager.SensorData.RpmMax = value;
base.OnPropertyChanged("MaxRpm");
}
}
Oct 24, 2011 at 9:27 PM

I am confused on your user's requirement.  You should be asking them why the minimum is 3000, yet they want to be able to set it to 0.  If they want to be able to set the value to 0, then the Min should be 0.  Even the ability to display a value that is not allowed by the minimum will create a very confusing user experience.  I would sit down with your user and try to determine why they require this confusing and inconsistant behavior.

In order to accomplish this task, you can try a couple of things.

  1. Create a property to databind the Minimum property against,so you can change the Min to 0 temporarily, then reinstate the Min of 3000 when neccessary.
  2. Create a new control that has a different display text than the actual value.
Oct 25, 2011 at 3:36 PM

Yes, I think it will make more sense to stay with the mins that are in the IntUpDown rather then try to change them, find some work around here.

I do have another questions for you if that is OK.
I am now testing deploying this app, it uses .NET 3.5, works fine on XP. I am getting issues on Windows 7, System.BadImageFormatException.
So I am in the process of eliminating what is causing that.
The installer included both, WPFToolkit.dll, and WPFToolkit.Extended.dll, is that correct?
I assume this all should work fine on Win 7.
Thanks
Jeff


"brianlagunas" <notifications@codeplex.com>

10/24/2011 03:27 PM

Please respond to
wpftoolkit@discussions.codeplex.com

To
jeff.collett@mercmarine.com
cc
Subject
Re: IntegerUpDown Question [wpftoolkit:277030]





From: brianlagunas

I am confused on your user's requirement. You should be asking them why the minimum is 3000, yet they want to be able to set it to 0. If they want to be able to set the value to 0, then the Min should be 0. Even the ability to display a value that is not allowed by the minimum will create a very confusing user experience. I would sit down with your user and try to determine why they require this confusing and inconsistant behavior.

In order to accomplish this task, you can try a couple of things.
1. Create a property to databind the Minimum property against,so you can change the Min to 0 temporarily, then reinstate the Min of 3000 when neccessary.
2. Create a new control that has a different display text than the actual value.

Read the full discussion online.

To add a post to this discussion, reply to this email (wpftoolkit@discussions.codeplex.com)

To start a new discussion for this project, email wpftoolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Oct 25, 2011 at 3:58 PM

Yes, the .NET 3.5 version requires the WPFToolkit.dll, and yes it works fine on Windows 7.  It is developed on a Windows 7 machine.