Results 1 to 2 of 2

Thread: WPF UserControls Sample in VB.NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Location
    Europe
    Posts
    12

    WPF UserControls Sample in VB.NET

    Had to start writing WPF UserControls because there is no ImageButton and no NumericUpDown in the WPF toolbox. Made many searches, snippet conversion from C# and read the documentation. Maybe it's useful for interested persons to have an example in VB that shows a bit more than just the minimum requirements.
    Most parts are based on code and most of of the xaml was created by the designer.
    The solution is a 'WPF User Control Library (.NET Framework)' which can hold several controls side by side. Xaml and code can easyly be found for fixing and improving. New controls or variations can be added at any time.
    I've added a WPF application to the solution to test the controls in place.

    Other WPF applications can use the controls by adding a reference to the library and adding the namespace to the window. This can be done by typing 'xmlns:ucs=' and selecting the corresponding item from the list (WpfUserControlsSampleVb). Then the controls can be inserted to the panel by typing, for example, <ucs:ImageButton/>
    -'ucs' is a short reference name defined by the user, must be unique-

    Adjustments to the control can be made with the designer and in the Properties window, quite comfortable:
    Name:  Ucs_PropertyCategory.PNG
Views: 1424
Size:  9.9 KB


    It should be possible to modify existing controls.
    It should also be possible to combine a number of controls to one new control.



    The controls:

    Name:  Ucs_5_controls.PNG
Views: 1105
Size:  11.6 KB

    ImageButton My first simple ImageButton. Some parts were created with Blend. I've tested it a while and it seems to work
    ImageButton2 Improved ImageButton, can place the image left and right, added padding, margin, and TextAlignment. Not much tested
    NumericUpDown Tried to make it almost as comfortable as the WinForms control is
    ProgressCircle (ProgressPie) – Visualisation of progress. A bit geometry and a bit rendering
    Knob Like a volume knob on a classic radio. A mixture of ProgressCircle and NumericUpDown.


    WpfUserControlsSampleVb.zip
    Last edited by kensen; Nov 25th, 2020 at 02:14 PM. Reason: Merged 5 control images to 1 image

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Location
    Europe
    Posts
    12

    Re: WPF UserControls Sample in VB.NET

    This project is continued this repository on GitHub

    Changes made:

    - changed the name to avoid confusion with other projects and examples
    - little fixes and improvements
    - added 'IsEnabled' property to some controls
    - added SelectorButton, SmallSlider, ToggleButton and VU-Bar control
    - added 'SetValueSilent' Method to some controls
    - added SidePanel control

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width