Today’s DotNetBar for WinForms update, contains improvements to Schedule control that many of you have been asking for. Now you can control time display in Day/Week view. Default view shows the working and non-working hours as specified on CalendarModel.WorkDays.WorkStartTime/WorkEndTime, i.e. you see 24 hours or whole day. Here is image that shows default view, notice that non-working hours have gray background:

But if you set CalendarView.ShowOnlyWorkDayHours=true you will see only working hours displayed on calendar. This image shows that, notice that non-working hours are not visible:

Images on appointments

Latest release also adds easy way to assign images to appointment. On each model Appointment object there are two properties you can use to do so:

  • Appointment.ImageKey – Specifies the key of the image in the ImageList that you assign to CalendarView.Images property.
  • Appointment.ImageAlign – Specifies the alignment of the image inside of appointment.

Here is screen-shot of two appointments with images assigned:

Yellow appointment has default image alignment, which is top-left, and blue appointment has bottom-right image alignment.

Release with these new features is available now.

Tagged with:
 

Here we go again. New version of DotNetBar is out and this time we included Office 2010 beta style and Windows 7 style for Ribbon control and they look absolutely stunning. DotNetBar is worlds’ first control to include Office 2010 and Windows 7 styles. Not surprising because we also released worlds’ first ribbon control for both Windows Forms and WPF :-)…

While Office 2010 is still in beta and we expect that color schemes will change in final release, main design elements will most likely not change. So expect that we will tweak the Office 2010 styling in coming months as the design finalizes.

Office 2010 style looks gorgeous running on Windows 7 or Windows Vista with glass enabled. Here is screen-shot of new styling with desktop background image visible so you can see how glass extends into ribbon tab area:

DotNetBar RibbonPad sample with Office 2010 style running on Windows 7

And here is Windows 7 style screen-shot:

DotNetBar RibbonPad sample in Windows 7 Style

There are over 55 new feature and enhancements in this release. Here are detailed Release Notes.

How to use new StyleManager

We often received requests for an easier way to change style for all DotNeBar controls in application. To do that now there is a StyleManager component. StyleManager has instance and static properties that you can use to switch the style on all controls that have Style=StyleManagerControlled property set. You can use it to do color tinting of current style as well. Just set ColorTint property.To use it in existing application follow these two steps:

  1. Set Style=StyleManagerControlled on all your controls
  2. Add StyleManager to your main form, or if you do not have main form use static properties on StyleManager object to set style for all controls

This new release will take your apps to the new visual level. Try it out. If you already have DotNetBar license go to our Customer Only web site and download latest build. Fully functional trial version can be downloaded by clicking here.

Tagged with:
 

Hi everyone,

We just released new version of DotNetBar for WPF with all new Super Tab Control which includes 6 popular visual styles and 14 predefined color schemes for each tab. Here is screen shot to help you visualize this great new control:

WPF Super Tab Control

To get details on SuperTabControl functionality please click here to visit SuperTabControl information page.

Our very popular Schedule control receives very asked for functionality as well. Many of you asked us to enable customization of time slot duration in Day and Week views on calendar. This release includes support for that and more. Click here to read my previous post about this new functionality.

DotNetBar for WPF now includes total of 18 great looking controls for professional WPF applications.

Tagged with:
 

This is continuation of my post yesterday about new color selection controls in DotNetBar for WPF.

ColorItemSelector Control

ColorItemSelector is a control that provides list of Office style colors available for selection. It is used by ColorInput control on its drop-down, but you can use it as standalone control too. Here is screenshot of ColorItemSelector control:

ColorItemSelector

ColorItemSelector control key properties and events:

  • SelectedColor – Indicates the selected color, may be null if there is no color selected.
  • MoreColorsButtonVisibility – Indicates visibility of “More Colors…” button that opens the color selection dialog.
  • SelectedColorChanged event, occurs when selected color has changed.

ColorComb control

ColorComb control is another color selection tool that displays colors in a comb pattern. Here is screenshot of the ColorComb control:

ColorComb

ColorComb control key properties and events:

  • SelectedColor – Indicates the selected color, may be null if there is no color selected.
  • SelectedColorChanged event, occurs when selected color has changed.

ColorBlender control

ColorBlender is color selection tool that displays color palette and allows selection using mouse. Here is screenshot of the ColorBlender control:

ColorBlender

  • SelectedColor – Indicates the selected color, may be null if there is no color selected.
  • SelectedColorChanged event, occurs when selected color has changed.

ColorPickerButton control

ColorPickerButton control is design to be used on Ribbon and combined with ColorItemSelector. ColorPickerButton is contained in Ribbon assembly.

ColorPickerButton WPF Control

This is XAML code that you can use to setup ColorPickerButton:

<dc:ColorPickerButton>
<de:ColorItemSelector SelectedColor="{Binding Path=SelectedColor, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type dc:ColorPickerButton}}}" />
</dc:ColorPickerButton>

ColorPickerButton control key properties and events:

  • SelectedColor – Indicates the selected color, may be null if there is no color selected.
  • SelectedColorChanged event, occurs when selected color has changed.
Tagged with:
 

Latest DotNetBar for WPF 5.2 that is coming out really soon includes 5 new color related controls:

  1. ColorInput control which is text-box style control that allows you to type the color in RGB format, for example #FE20DE. It also includes drop-down color picker and a color chooser dialog.
  2. ColorItemSelector, is a color selector with Office style colors that you can use as standalone control, or combine with ColorPickerButton control.
  3. ColorComb control, a comb style color selector.
  4. ColorBlender, a palette style color selector.
  5. ColorPickerButton, a button that can be used on Ribbon and that you combine with ColorItemSelector to select pre-defined color.

ColorInput Control

ColorInput control allows you to enter the color using RGB format or to choose color from drop-down color picker. You can also use built-in color selection dialog to choose the color.

Here is how ColorInput control looks like:

ColorInput1

With drop-down showing Office style colors:

ColorInput2

ColorInput control key properties and events:

  • Value – indicates the selected color value. It may be null if there is no color selected.
  • EditColorAlphaComponent – Indicates whether control shows alpha transparency component in edit portion of control. Default value is false.
  • ShowDropDown – Indicates whether drop-down button on the right-hand side of control is shown.
  • ShowCheckBox – Indicates whether check-box is shown which allows end-user to make control read-only.
  • WatermarkText – Indicates the watermark text to be displayed in control when there is no value.
  • WatermarkAlignment – Indicates the watermark text alignment within the control.
  • WatermarkBehavior – Indicates whether watermark text is hidden when control gets input focus or when it has valid value.
  • WatermarkBrush – Indicates the brush used to render watermark text.
  • WatermarkEnabled – Indicates whether watermark is enabled.
  • MoreColorsButtonVisibility – Indicates whether drop-down color picker displays the “More Colors…” button.
  • ValueChanged bubbling event – Occurs when Value property changes.

Ribbon Styling

ColorInput control provides built-in style to blend into the Ribbon. Simply assign following Style to the ColorInput control:

<de:ColorInput Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=de:ColorInput, ResourceId=Ribbon}}"

Localization of system strings

One of the most common tasks when working with input controls is the localization or customization of system strings used by the control. All system strings that color input controls are using are defined as string resources and you can customize them as such easily by providing your own string resource. The string resource key ID’s are all available as static members of StringKeys class. Here is how to define custom string resources:

1.  Define namespace so you can use string type:

 <Window x:Class="Editors.Window1"
 xmlns:s="clr-namespace:System;assembly=mscorlib"

2.  Define custom string resources as such:

 <Window.Resources>
 <s:String x:Key="{ComponentResourceKey {x:Type de:StringKeys}, {x:Static de:StringKeys.MoreColorsButton}}">More Colors Custom</s:String>
 </Window.Resources>

That’s it. Note that you can define these resources in XAML by creating resource dictionary and then merging this to the application resources so customizations are application wide. You can also define them per control as well.

Customizing Colors On Drop-Down

To customize colors displayed on drop-down part of the ColorInput control, you need to define new style for ColorItemSelector control that is used by ColorInput control. Click here to download the XAML file which has sample style that you can re-use and modify to suite your needs.

Tomorrow, rest of the controls…

Tagged with:
 

Color Comb Cooking In The Kitchen

Here is work-in-progress screen-shot from some additions being worked on for our DotNetBar for WPF:

Color Comb in DotNetBar for WPF

WPF Color Blend

Yeah, I know, you can guess what it is 🙂

Tagged with:
 

Here it is. DotNetBar for Windows Forms 8.1 is now available. Included are over 40 new features and enhancements. I already covered two huge new controls:

If you do not own DotNetBar give it a try. We now have total of 50 controls to help you create professional WinForms applications. If you own DotNetBar license then go here to download latest build.

Tagged with:
 

In this post I will show you the new Highlighter component that will be included in DotNetBar for Windows Forms 8.1 that we are planning on releasing soon.

Highlighter component allows you to visually highlight any control on the form using distinctive border style. You can use it with our SuperValidator component to highlight validation errors on the form. You can use it to highlight currently focused text-box. Or simply to draw user attention to control on the form.

To start using Highlighter control just double-click the highlighter component in VS.NET Toolbox to add it to the form:

Figure 1 – Highlighter Components in VS.NET toolbox

This is how form looks like with Highlighter component added:

Figure 2 – Highlighter Component on the form

To each control on the form the Highlighter component will add two properties:

  • HighlightColor – Specifies the color to highlight the control with.
  • HighlightOnFocus – Specifies whether control is automatically highlighted when it receives input focus. Highlighter.FocusHighlightColor property specifies the color that will be used for focus based highlighting.

To highlight any control on the form select the control and set HighlightColor property:

Figure 3 – Setting HighlightColor property

This is how control would appear at run-time with HighlightColor property set:

Figure 4 – Highlighter component highlighting the control

Setting HighlightColor from code

To set HighlightColor using code, use following statement:

highlighter1.SetHighlightColor(textBoxX1, eHighlightColor.Green)

To remove highlight from the control use following statement:

highlighter1.SetHighlightColor(textBoxX1, eHighlightColor.None)

Highlighting Focused Control

Highlighter component provides you with functionality to highlight control with the input focus automatically. All you have to do is set HighlightOnFocus property on each control on the form that you want to highlight. The easiest way to do that is to select all controls on the form you want to highlight as they receive focus:

Figure 5 – Select all controls you want to highlight on focus

Then in VS.NET property window set HighlightOnFocus property to true:

Now when you run your project and tab through controls on the form you will see the focused control highlighted:

To create focus highlighting from code use following statement:

highlighter1.SetHighlightOnFocus(textBoxX1, True)

and to remove focus highlight use following statement:

highlighter1.SetHighlightOnFocus(Me.textBoxX1, False)

I hope that this provides you with the good overview of the new Highlighter component that is unique to DotNetBar. I am sure in couple of months you will see clones everywhere, like it usually happens with new stuff we create 🙂

Tagged with:
 

This post covers new components that will be included in next version of DotNetBar for Windows Forms 8.1 that we are wrapping up right now. Today I will cover the all new SuperValidator component.

DotNetBar SuperValidator is the component set that helps you implement validation of user input in your WinForms applications without writing any code for most common validation scenarios. Here is screen-shot that shows simple validation performed on the form using SuperValidator and Highlighter controls included with DotNetBar:

1 – Super Validator control in action

To start using validations components, first drop the SuperValidator component from VS.NET toolbox onto your form:

2 – SuperValidator Component in VS.NET Toolbox

3 – SuperValidator added to VS.NET Form

Notice that when SuperValidator component is added to the form it automatically creates two supporting components:

  • ErrorProvider component to display the error state and tooltip message next to each input field
  • Highlighter component to visually highlight input field with error using distinctive border

SuperValidator can work with any of these components set or without any of them at all if you are planning to report validation results some other way.

Choosing when to perform validation

Next step is to choose the way SuperValidator performs validation. That is done by setting ValidationType property as shown in image below:

4 – ValidationType property setting

ValidationType values explained:

  • Manual – You perform validation by calling SuperValidator.Validate method.
  • ValidatingEventPerControl – For each control that is being validated the SuperValidator will handle its Validating event and perform validation. If validation fails it will use ErrorProvider and Highlighter that are set to indicate the error as well as cancel the focus move if CancelValidatingOnControl property is set to true (default value)
  • ValidatingEventOnContainer – Validating event will be handled on ContainerControl, by default the parent form, to perform validation. If validation fails all failures will be reported using ErrorProvider and Highlighter, if set. The Cancel event argument in Validating event for container will be set to false as well if validation fails.

Assigning Validation To Controls

SuperValidator control adds Validator1, Validator2 and Validator3 properties to each control on the form as shown in image below:

5 – SuperValidator Properties

These properties allow you to define 3 level validation for each control. Validation starts with Validator1, Validator2 and finally Validator3. You can assign one of these properties or all of them if you need to perform multi-level validation. For example you can require the input for text-box and enforce the format to be an email by assigning Validation1 and Validation2 properties.

Select control you want to assign validation to and change its Validator1 property to choose desired validation type.

6 – Select control to set validation for

7 – Choosing validation for input text-box

In this example we will choose “Required Field Validator” which will ensure that text-box has value.

Next, expand the Validator1 property to set validation properties:

8 – Changing Validation Properties

Here is explanation for each property on validator in the order they are displayed in screen-shot above:

  • DisplayError – Indicates whether failed validation is reported or not. The failed validation will still be available programmatically through LastFailedValidationResults collection.
  • Enabled – Indicates whether validation is enabled.
  • ErrorMessage – Is the message that is displayed through error provider to indicate to end-user what the problem is.
  • HighlightColor – Specifies the highlight color that Highlighter component, if set, will use to highlight the control when validation fails.
  • IsEmptyStringValid – For controls that support Null/Nothing values this property indicates whether an empty string is considered valid value.
  • OptionalValidationGroup – Indicates the name of the group that validation belongs to. Groups are used to validate multiple controls as a single entity and allows you to for example require input in any of the controls in a group but not all of them.
  • ValuePropertyName – Indicates the property name that holds control value. SuperValidator usually guesses correctly the property name (for example Text on TextBox) but in case you are using custom control with unusual property name that holds value of the control you can set it here.

Regular Expression Validation

In previous example you’ve seen required field validator. SuperValidator also provides validation based on the Regular Expressions. You can read more about regular expressions in MSDN starting at following URL: http://msdn.microsoft.com/en-us/library/hs600312%28VS.80%29.aspx

When Regular Expression Validator is assigned to input field it looks like this in property grid:

9 – Regular Expression Validator

Here is description for the properties that are specific to this validator:

  • EmptyValueIsValid – Indicates whether validator will allow empty input values.
  • ValidationExpression – Specifies the regular expression to use for control’s value validation. You can type your own regular expression or use drop-down button to choose one of the pre-defined expressions included with control.

Comparison Validation

SuperValidator component includes Comparison Validation that allows you to compare values of two input fields or to compare input field value to a predefined value you set. You can use this for example to ensure that password entered matches the confirmation password on input form or to ensure that numeric input value is greater than number you specify. Here is an example of input form that uses comparison validation to ensure that two password fields are the same:

10 – Comparison validation example form

These are properties set on confirmation password text-box that have comparison validator assigned:

11 – Comparison Validator properties

Here is description for properties that are specific to comparison validator:

  • ControlToCompare – Specifies the control to compare the input value to. In the example above we will compare the confirmation password text box to the password text box.
  • ControlToCompareValuePropertyName – Is the name of property that holds control value. Usually it is not necessary to set unless you want to use specific property as value property.
  • Operator – Specifies the operator that is used for comparison. Following image shows available operators:
  • ValueToCompare – Specifies the value to compare input value to using specified Operator. You would set this property if you want to use comparison operator to ensure certain value is entered in input control. Note that this value is used for comparison only if ControlToCompare property is not set.

Range Validation

Range validator allows you to ensure that input value is in certain range. Here are properties available on range validator:

Here is description for properties that are specific to range validator:

  • MaximumValue – Indicates maximum value.
  • MinimumValue – Indicates minimum value.

Custom Validation

When none of available validation options fit the bill you can use custom validator and write your own validation code. When you assign the custom validation to a control here is what you see:

12 – Custom validator

Next step is to attach event handler for ValidateValue event on custom validator. First, select CustomValidator instance in VS.NET property grid using the combo-box on top of the property grid:

With CustomValidator component selected, switch to the event view:

And double-click the ValidateValue event to create event handler:

Here is example code for ValidateValue event handler:

C#:

private void customValidator1_ValidateValue(object sender, DevComponents.DotNetBar.Validator.ValidateValueEventArgs e) {

if (e.ControlToValidate.Text == “DotNetBar”)
e.IsValid =
true;
else

e.IsValid =
false;

}

VB:

Private Sub customValidator1_ValidateValue(ByVal sender As System.Object, ByVal e As DevComponents.DotNetBar.Validator.ValidateValueEventArgs) Handles customValidator1.ValidateValue
    If e.ControlToValidate.Text = "DotNetBar"  Then				
       e.IsValid = True
    Else
        e.IsValid = False
    End	If
End  Sub

This example validation simply checks whether value entered is “DotNetBar” and validates control input if it is.

Working with SuperValidator from Code

When working with SuperValidator using VS.NET designer all settings that you make are actually translated into the code that you can find in InitializeComponent() method of your form. The easiest way to find out how to do something from code is to setup the control the way you want it using designer and then explore InitializeComponent() method.

Here is simple setup for SuperValidator control:

C#:

SuperValidator superValidator1 = new SuperValidator();
superValidator1.ContainerControl = myParentForm;
superValidator1.ErrorProvider = myErrorProvider1;
superValidator1.Highlighter = myHighlighter1;
superValidator1.ValidationType = DevComponents.DotNetBar.Validator.eValidationType.ValidatingEventOnContainer;

VB:

Dim superValidator1 As DevComponents.DotNetBar.Validator.SuperValidator
superValidator1 = New DevComponents.DotNetBar.Validator.SuperValidator
superValidator1.ContainerControl = myParentForm
superValidator1.ErrorProvider = myErrorProvider1
superValidator1.Highlighter = myHighlighter1
superValidator1.ValidationType = DevComponents.DotNetBar.Validator.eValidationType.ValidatingEventOnContainer

Assigning validation to a control on the form is done using following code:

C#:

RequiredFieldValidator requiredFieldValidator1 = new RequiredFieldValidator();
requiredFieldValidator1.ErrorMessage = "Please enter First Name.";
requiredFieldValidator1.HighlightColor = DevComponents.DotNetBar.Validator.eHighlightColor.Red;
superValidator1.SetValidator1(textBoxX1,requiredFieldValidator1);

VB:

Dim requiredFieldValidator1 As RequiredFieldValidator
requiredFieldValidator1 = New RequiredFieldValidator()
requiredFieldValidator1.ErrorMessage = "Please enter First Name."
requiredFieldValidator1.HighlightColor = DevComponents.DotNetBar.Validator.eHighlightColor.Red
superValidator1.SetValidator1(textBoxX1,requiredFieldValidator1)

To remove validator from control you would use following code:

C#:

superValidator1.SetValidator1(textBoxX1, null);

VB:

superValidator1.SetValidator1(textBoxX1, Nothing)

Handling Cancel button on the form

If you have dialog form with validation attached to the controls and validation type is set to per-control or container, to be able to close the form as response to Cancel button being clicked you would simply disable validator by setting Enabled property to false:

superValidator1.Enabled = false

Then you can close your form as usual using Close method.

Custom Error Providers

If you wish to use custom error provider to display validation errors in your application you can do so by implementing IErrorProvider interface. You assign your custom error provider to CustomErrorProvider property.

I hope this gives you a good overview of the new SuperValidator component. Stay tuned for more…

Tagged with:
 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

© 2009 Denis Basaric: DevComponents Blog