I want to make a Conversion, to convert Decimal to Int. Look at my code:
<ProgressBar Margin="0,10,0,10"
Grid.Row="2" Grid.ColumnSpan="3" IsIndeterminate="False" Height="10"
Maximum="{Binding SavingGoal, Converter={StaticResource DecimalToInt}}" Value="{Binding Balance, Converter={StaticResource DecimalToInt}}"/>
newGoal.SavingGoal = Convert.ToDecimal(SavingsAmountsTextBox.Text);
newGoal.Balance = 0;
public decimal SavingGoal { get; set; }
public decimal Balance { get; set; }
Do you realy need a decimal? The Maximum property and the Value property are doubles, so if this project is about money just use double. If you don't need more than 16 digits after comma, a double makes more sence.
If you still want to convert with a Converter convert it in the Convert()-Method of your Converter Class
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
decimal x = (decimal)value;
return Decimal.ToInt32(x);
}