failedtofail
Member
- Joined
- Jun 16, 2022
- Messages
- 20
- Programming Experience
- Beginner
I have a basic textbox as follows in my xaml file:
The text attribute of the textbox is bound to the CondCHeight as per the above but CondCHeight is a double:
I get an error because the textbox.text attribute is expecting a string not a double.
My data context is set as follows:
How can I get rid of this error?
Strange thing is, it still works! Program runs fine.
Thanks.
C#:
<TextBox x:Name="txtbxHCondC" Text="{Binding Path = CondCHeight, Mode=OneWayToSource}" Grid.Row="6" Grid.Column="18" FontSize="12" TextAlignment="Left" VerticalAlignment="Center" BorderThickness="0" Grid.ColumnSpan="3" />
The text attribute of the textbox is bound to the CondCHeight as per the above but CondCHeight is a double:
C#:
public double CondCHeight
{
get { return condCHeight; }
set
{
condCHeight = value;
//OnPropertyChanged("CondCHeight");
}
}
I get an error because the textbox.text attribute is expecting a string not a double.
My data context is set as follows:
C#:
<UserControl.Resources>
<vm:CalculatorViewModel x:Key="calculatorVM" />
</UserControl.Resources>
<Grid DataContext="{Binding Source={StaticResource calculatorVM}}">
How can I get rid of this error?
Strange thing is, it still works! Program runs fine.
Thanks.