There is a Test class and there is a collection in which the processing progress is to be monitored.
Did as below, but every now and then the exception appears "The default value type does not match the property type".
Code-behind:
public static DependencyProperty ProgressProperty = DependencyProperty.Register("Progress", typeof(double), typeof(Test), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender))); public static DependencyProperty MaxProperty = DependencyProperty.Register("Max", typeof(double), typeof(Test), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender))); public static DependencyProperty MinProperty = DependencyProperty.Register("Min", typeof(double), typeof(Test), new FrameworkPropertyMetadata(FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender))); Xaml markup looks like this:
<ProgressBar x:Name="pbMain" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Height="20" Maximum="{Binding Source={x:Static local:Test.MaxProperty}}" Value="{Binding Source={x:Static local:Test.ProgressProperty}, Mode=OneWay}" Minimum="{Binding Source={x:Static local:Test.MinProperty}}" /> Do I understand correctly that binding should be done through dependency properties?