This Library contains some User-and CustomControls for the use in WPF .Net and WPF .Net Framework applications.
From version 1.2 onwards, it is a .Net project that targets .Net and .NetFramework.
There's a compromise between looking good, working well, and acceptable programming effort.
The current version offers quick and easy usability, while the graphics and the user input are kept rather simple.
The test application is an important part of the project. On the one hand to present and describe the controls, on the other hand for debugging and development.
During development, it became clear that not all ideas can be solved with UserControls. Where necessary, CustomControls were added to the library.
Make sure you reference the correct library for your project type.
The .NET library is located in '/bin/.../net8.0-windows' (depending on the .NET version), while the .NET Framework library is located in '/bin/.../net48' (depending on the .NET Framework version).
- References / Add Reference -> DailyUserControls
- In XAML header add namespace:
xmlns:duc="clr-namespace:DailyUserControls;assembly=DailyUserControls" - In XAML body (Window Content / Grid etc.) insert the control:
<duc:NumericUpDown/> - Change the properties in the Properties Window. Brushes can be found at the top while special properties are grouped together in one category at the end.
Some value controls have a SetValueSilent method. This is useful in some special cases, generally when user and program code can set the value of the control. SetValueSilent causes the control's value to be updated, but does not raises a ValueChanged event.
It is important that for every image used as a resource, the BuildAction is set to "Resource" and not to "None". Otherwise, the build process may complete successfully, but then a runtime error may occur. This can happen if the images are inserted into the project via drag and drop.
There seems to be a bug in VS 2022 17.5.5+
and also in VS 2019 when Preview features /New WPF-XAML Designer for .NET Framework is checked:
When creating a ValueChanged handler by double-clicking the event in the designer, an incomplete handler for ValueChanged is inserted.
It is not due to the user controls but can also be observed with the built-in slider control.
Private Sub Slider1_ValueChanged(sender As Object, e As RoutedPropertyChangedEventArgs(Of T))
End Sub
Error BC30002 Type ‘T’ is not defined.
This can be corrected by completing the handler to:
Private Sub Slider1_ValueChanged(sender As Object, e As RoutedPropertyChangedEventArgs(Of Double)) Handles Slider1.ValueChanged
End Sub
There is now also an event in XAML:
ValueChanged="Slider1_ValueChanged"
This should be deleted, else ValueChanged is called twice.
'Handles' seems to be VB specific, it might work a little differently in C#.
Until version 1.0.5.9, initial values for Width, Height, HorizontalAlignment and VerticalAlignment were set in the constructor. The intention was to give the controls an initial size to simplify the design process. Over time, however, it became apparent that this made designing more difficult and some settings for sizing and alignment could no longer be made.
Therefore, in version 1.0.6.0 the initial settings for Width, Height, HorizontalAlignment and VerticalAlignment were removed. The behavior when adding UserControls to the design now corresponds to that of the built-in controls, such as the button. Width and Height are set to Stretch and so the initial size can be, for example, 600 x 400. The designer must now first limit the size, but in return he regains full control over the design.




