VIBlend
Home Products Downloads Purchase Support Forum About Blog

VIBlend Silverlight Controls 6.5

by viblend 19. August 2012 16:54

We are happy to announce the availability of VIBlend Controls for Silverlight ver. 6.5. The new version includes multiple bug fixes and small improvements to the existing features and themes of the package. 

  

Filter Silverlight DataGrid data programmatically

by viblend 10. July 2012 16:22
In order to achieve this, you need to follow the steps below:
 
1. Create DataGrid’s Rows, Columns and fill it with sample data. 
 
C#

for (int i = 0; i < 20; i++)
{
    this.dataGrid1.ColumnsHierarchy.Items.Add("Column " + i);
    this.dataGrid1.RowsHierarchy.Items.Add("Row " + i);
}

this.dataGrid1.AllowContextMenuFiltering = true;
this.dataGrid1.AllowContextMenuSorting = true;
Random random = new Random();

for (int i = 0; i < 20; i++)
{
    HierarchyItem row = this.dataGrid1.RowsHierarchy.Items[i];
    for (int j = 0; j < 20; j++)
    {
        HierarchyItem column = this.dataGrid1.ColumnsHierarchy.Items[j];
        column.AllowFiltering = true;
        this.dataGrid1.CellsArea.SetCellValue(row, column, (double)i);
    }
}

this.dataGrid1.ColumnsHierarchy.AutoResize(AutoResizeMode.FIT_ALL);
this.dataGrid1.RowsHierarchy.AutoResize(AutoResizeMode.FIT_ALL);

VB .NET

For i As Integer = 0 To 19
    Me.dataGrid1.ColumnsHierarchy.Items.Add("Column " & i)
    Me.dataGrid1.RowsHierarchy.Items.Add("Row " & i)
Next i

Me.dataGrid1.AllowContextMenuFiltering = True
Me.dataGrid1.AllowContextMenuSorting = True
Dim random As New Random()

For i As Integer = 0 To 19
    Dim row As HierarchyItem = Me.dataGrid1.RowsHierarchy.Items(i)
    For j As Integer = 0 To 19
        Dim column As HierarchyItem = Me.dataGrid1.ColumnsHierarchy.Items(j)
        column.AllowFiltering = True
        Me.dataGrid1.CellsArea.SetCellValue(row, column, CDbl(i))
    Next j
Next i

Me.dataGrid1.ColumnsHierarchy.AutoResize(AutoResizeMode.FIT_ALL)
Me.dataGrid1.RowsHierarchy.AutoResize(AutoResizeMode.FIT_ALL)
 
2. Create a new NumericFilter and set its ComparisonOperator and Value properties
 
C#

NumericFilter filter = new NumericFilter();
filter.ComparisonOperator = NumericComparisonOperator.GREATER_THAN;
filter.Value = 5;
FilterGroup<double?> filterGroup = new FilterGroup<double?>();
filterGroup.AddFilter(FilterOperator.AND, filter);

VB .NET

Dim filter As New NumericFilter()
filter.ComparisonOperator = NumericComparisonOperator.GREATER_THAN
filter.Value = 5
Dim filterGroup As FilterGroup(Of Nullable(Of Double)) = New FilterGroup(Of Nullable(Of Double))()
filterGroup.AddFilter(FilterOperator.AND, filter)

3. Create a new HierarchyItemFilter object and add the FilterGroup to it. 
 
C#

HierarchyItemFilter itemFilter = new HierarchyItemFilter();
itemFilter.Item = this.dataGrid1.ColumnsHierarchy.Items[0];
itemFilter.Filter = filterGroup;

VB .NET

Dim itemFilter As New HierarchyItemFilter()
itemFilter.Item = Me.dataGrid1.ColumnsHierarchy.
itemFilter.Filter = filterGroup
 
4. Finally, add the HierarchyItemFilter instance to the Filters collection of the DataGrid’s RowsHierarchy. 
 
C#

this.dataGrid1.RowsHierarchy.Filters.Add(itemFilter);

VB .NET

Me.dataGrid1.RowsHierarchy.Filters.Add(itemFilter)
 

Silverlight TreeView with Radio Button

by viblend 16. February 2012 21:15
This post will show you how to add radio buttons to the TreeView items.

In order to display radio buttons in the VIBlend TreeView for Silverlight, you need to set the EnableCheckboxes property to true and also the ListItemType of each TreeViewItem to "RadioButton".

For example:

<viblend:TreeView EnableCheckBoxes="True" Width="280" Height="300" x:Name="TreeView">
    <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="VIBlend" Value="VIBlend" ImageSource="/Images/user.png">
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Contacts" Value="Contacts" ImageSource="/Images/contacts.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Desktop" Value="Desktop" ImageSource="/Images/desktop.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Documents" Value="Documents" ImageSource="/Images/documents.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Downloads" Value="Downloads" ImageSource="/Images/folder.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Favorites" Value="Favorites" ImageSource="/Images/favorites.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Music" Value="Music" ImageSource="/Images/music.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Pictures" Value="Pictures" ImageSource="/Images/Pictures.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Searches" Value="Searches" ImageSource="/Images/searches.png"/>
        <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Videos" Value="Videos" ImageSource="/Images/videos.png"/>
    </viblend:TreeViewItem>
    <viblend:TreeViewItem ListItemType="RadioButton" DisplayValue="Inbox" Value="Inbox" ImageSource="/Images/folder.png"/>
</viblend:TreeView>

Here's the resulting TreeView:
  

Implementing multi-threading in WinForms using the BackgroundWorker class and the VIBlend WinForms ProgressBar.

by viblend 31. January 2012 04:24
In this post we’ll create a simple multi-threaded WinForms application and will use the VIBlend WinForms ProgressBar control to report the progress to the user. The application will loop through numbers from 0 to 999. The progress bar will be filled during the process.

Let’s start by creating a Windows Application. In designer of the form, add the BackgroundWorker component from the “Components” category. The component is added to the bottom section of the designer.  Click it and set the WorkerReportsProgress property to true - this allows us to send progress notifications. Subscribe to the BackgroundWorker's DoWork and ProgressChanged events. The background task is handled in the DoWork event. The handler for this event will be called from a new worker thread. The ProgressBar will be updated in the ProgressChanged event handler. In order to notify about the progress you should call the ReportProgress method from the DoWork event handler. Please note that the ReportProgress method will work only when the WorkerReportsProgress property of the BackgroundWorker class is set to true.  

The next step is to create the User Interface. Drag and drop vButton and vProgressBar controls from the Visual Studio toolbox. Subscribe to the Button's Click event. To start doing the work we will call the RunWorkerAsync method of the BackgroundWorker in the Button's Click event handler.

In the ProgressChanged event handler, we will update the ProgressBar's value.

C#

private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
   // update the progress bar
    this.vProgressBar1.Value = e.ProgressPercentage;
    this.vProgressBar1.Refresh();
}

VB .NET

Private Sub worker_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
   ' update the progress bar
Me.vProgressBar1.Value = e.ProgressPercentage
Me.vProgressBar1.Refresh()
End Sub

Report the Progress in the DoWork event handler.

C#

private void worker_DoWork(object sender, DoWorkEventArgs e)
{
              int limit = 999;
for (int currNumber = 0; currNumber < 999; currNumber++)
{
       int progressPercentage = (100 * currNumber) / (limit);
                   worker.ReportProgress(progressPercentage);
}
}

VB .NET

Private Sub worker_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
 Dim limit As Integer = 999
For currNumber As Integer = 0 To 998
  Dim progressPercentage As Integer = (100 * currNumber) / (limit)
  worker.ReportProgress(progressPercentage)
Next currNumber
End Sub
 
 

VIBlend Silverlight Controls 6.0 With New Metro UI Themes

by viblend 18. January 2012 16:47

We are happy to announce the availability of VIBlend Silverlight Controls 6.0.  The newest version of VIBlend Silverlight Controls includes a set of new Metro UI Themes - Metro Blue, Metro Green and Metro Orange themes.

To download an evaluation version, please visit our Download page. 

View the updated Online Demo.

 

What's coming with VIBlend WPF Controls 5.0

by viblend 11. December 2011 04:54
The new version of VIBlend WPF Controls will come with a brand new Slider control. The Slider is a scrollable control similar to the ScrollBar control. You can configure ranges by setting the Minimum property to specify the lower end of the range and the Maximum property to specify the upper end of the range. You can use this control to input numeric data obtained through the Value property. You can display this numeric data in a control or use it in code. The Slider will have an option to be displayed horizontally or vertically.

Here is an image of the Slider control:
 
 

VIBlend Silverlight Controls 5.1

by viblend 29. September 2011 18:22
The updated version of VIBlend Silverlight Controls has just came out. 
  
What's New: 
 
DataGrid Columns Chooser.
DataGrid Grouping Headers Renderer.
Added support for Silverlight 5 RC.
 
What's Fixed:
 
Resolved an issue regarding the DataGrid scrolling.
Resolved an issue regarding the DataGrid HierarchyItem's rendering.
Resolved an issue regarding the HierarchyItem Templates.
Resolved an issue regarding the DataGrid data binding.
Resolved an issue regarding the DataGrid Dispose logic.
Resolved an issue regarding the DataGrid localization.
Resolved an issue regarding the Scheduler repeating appointments.
Resolved an issue regarding the Scheduler day view rendering.
Resolved an issue regarding the Scheduler Appointment dialog.
Resolved an issue regarding the Scheduler resources binding.
Resolved an issue regarding the Scheduler Appointments layout in Day View.
Resolved an issue regarding the DataTimePicker's date formatting.
Resolved an issue regarding the ComboBox selection. 

Silverlight Ribbon Key Tips

by viblend 6. September 2011 06:07

VIBlend RibbonBar offers an easy way to execute commands using Key Tips.  When an end-user presses the Space or F10 key, Key Tips automatically appear. They disappear when the command associated to a KeyTip is executed, or when the user presses the Esc key or clicks a mouse button.

The example code below demonstrates how to create a KeyTip for a UIElement: 

<viblendRibbonBar:RibbonBar.QuickAccessItems>
      <editors:Button Command="{Binding SaveCommand}" viblendRibbonBar:QuickAccessToolbar.MenuItemText="Save" viblendRibbonBar:KeyTipService.Text="1" viblendRibbonBar:KeyTipService.Command="{Binding SaveCommand}" viblendRibbonBar:KeyTipService.Key="D1"/>
      <editors:Button Command="{Binding RedoCommand}" viblendRibbonBar:QuickAccessToolbar.MenuItemText="Redo" viblendRibbonBar:KeyTipService.Text="2" viblendRibbonBar:KeyTipService.Command="{Binding RedoCommand}" viblendRibbonBar:KeyTipService.Key="D2"/>
      <editors:Button Command="{Binding UndoCommand}" viblendRibbonBar:QuickAccessToolbar.MenuItemText="Undo" viblendRibbonBar:KeyTipService.Text="3" viblendRibbonBar:KeyTipService.Command="{Binding UndoCommand}" viblendRibbonBar:KeyTipService.Key="D3"/>
</viblendRibbonBar:RibbonBar.QuickAccessItems>

The KeyTip.Text property allows you to set the text which will be displayed in the KeyTip. The Command and CommandParameter properties allow you to associate a Command to the KeyTip. The command is executed when the user presses the Key associated to the KeyTip.

The sample code below demonstrates how to create the commands from the above code.

C#

public RibbonCommand SaveCommand { get; set; }
public RibbonCommand UndoCommand { get; set; }
public RibbonCommand RedoCommand { get; set; }

public KeyTips()
{          
    InitializeComponent();

    this.SaveCommand = new RibbonCommand(Save, CanExecuteCommand);
    this.UndoCommand = new RibbonCommand(Undo, CanExecuteCommand);
    this.RedoCommand = new RibbonCommand(Redo, CanExecuteCommand);
    this.ribbonBar1.DataContext = this;
 }

private void Save(object parameter)
{
    MessageBox.Show("Save Command");
}

private void Undo(object parameter)
{
    MessageBox.Show("Undo Command");
}

private void Redo(object parameter)
{
    MessageBox.Show("Redo Command");
}

private bool CanExecuteCommand(object parameter)
{
     return true;
}

VB.NET

Private privateSaveCommand As RibbonCommand
Public Property SaveCommand() As RibbonCommand
    Get
        Return privateSaveCommand
    End Get
    Set(ByVal value As RibbonCommand)
        privateSaveCommand = value
    End Set
End Property
Private privateUndoCommand As RibbonCommand
Public Property UndoCommand() As RibbonCommand
    Get
        Return privateUndoCommand
    End Get
    Set(ByVal value As RibbonCommand)
        privateUndoCommand = value
    End Set
End Property
Private privateRedoCommand As RibbonCommand
Public Property RedoCommand() As RibbonCommand
    Get
        Return privateRedoCommand
    End Get
    Set(ByVal value As RibbonCommand)
        privateRedoCommand = value
    End Set
End Property

Public Sub New()
    InitializeComponent()

    Me.SaveCommand = New RibbonCommand(AddressOf Save, AddressOf CanExecuteCommand)
    Me.UndoCommand = New RibbonCommand(AddressOf Undo, AddressOf CanExecuteCommand)
    Me.RedoCommand = New RibbonCommand(AddressOf Redo, AddressOf CanExecuteCommand)
    Me.ribbonBar1.DataContext = Me
End Sub

Private Sub Save(ByVal parameter As Object)
    MessageBox.Show("Save Command")
End Sub

Private Sub Undo(ByVal parameter As Object)
    MessageBox.Show("Undo Command")
End Sub

Private Sub Redo(ByVal parameter As Object)
    MessageBox.Show("Redo Command")
End Sub

Private Function CanExecuteCommand(ByVal parameter As Object) As Boolean
     Return True
End Function


You can change the KeyTips activation and deactivation keys by using the RibbonBar's KeyTipsActivationKey and KeyTipsDeActivationKey properties. 

VIBlend Controls for WinForms v7.0

by viblend 5. July 2011 00:32

We are pleased to announce the availability of VIBlend Controls for WinForms ver. 7.0.

Highlights of the new features and improvements in the new version are:

  • New SplitContainer control.
  • New DataGridView Saving and restoring layout feature. This feature allows you to persist columns states between application runs.
  • New DataGridView Filtering options and APIs.
  • Improved TreeView loading performance.
  • Improved DataGridView Progress and ComboBox Editors rendering.

To download an evaluation version, please visit our Download page. 

Repeating Appointments in VIBlend Scheduler

by viblend 21. June 2011 16:50

In this blog post, we demonstrate how to create and add repeating appointments to the VIBlend Silverlight Scheduler.

To create a repeating appointment in VIBlend Silverlight Scheduler, you can follow these steps:

  • Double-Click on any scheduler cell or right-click to open the built-in context menu and click ‘New Appointment’.
  • In the pop-up window that appears, click the Repeat... checkbox.
  • Choose your desired settings in the Recurrence Dialog and click ‘Ok’.
  • Fill in the appointment's other details.
  • Click Save and Close to confirm the changes.

To make an existing appointment repeat, follow these steps:

  • Double-Click on the appointment and in the pop-up window that appears, click the Repeat... checkbox.
  • Choose your desired settings in the Recurrence Dialog and click ‘Ok’.
  • Fill in the appointment’s other details.
  • Click Save and Close to confirm the changes.

To create a repeating appointment in the code-behind, follow these steps:

  • Create a new Appointment object. Set the appointment’s start, duration, subject, description and location fields.

C#

DateTime appointmentStart = DateTime.Now.Date;
TimeSpan appointmentDuration = new TimeSpan(1, 0, 0);
Appointment lunchBreak = new Appointment(appointmentStart, appointmentDuration, "Lunch Break", "Steamed fillet of trout, served with sour-cream sauce, cucumber salad and boiled potatoes", "Lunch Room 1");

VB .NET

Dim appointmentStart As DateTime = DateTime.Now.Date
Dim appointmentDuration As New TimeSpan(1, 0, 0)
Dim lunchBreak As New Appointment(appointmentStart, appointmentDuration, "Lunch Break", "Steamed fillet of trout, served with sour-cream sauce, cucumber salad and boiled potatoes", "Lunch Room 1")

  • Set the Appointment’s RecurrencePattern property to make it repeat. You can set this property to any class derived from the RecurrencePattern class. VIBlend Scheduler control provides four built-in recurrence patterns represented by the DayRecurrencePattern, MonthRecurrencePattern, YearRecurrencePattern and WeekRecurrencePattern classes. The following code snippet demonstrates how to specify a daily repeating behavior:

C#

lunchBreak.RecurrencePattern = new DayRecurrencePattern(lunchBreak.From, this.viblendScheduler.View.To, 1);

VB .NET

lunchBreak.RecurrencePattern = New DayRecurrencePattern(lunchBreak.From, Me.viblendScheduler.View.To, 1)

          In the daily recurrence pattern, you need to specify the RepeatIndex property which determines the days between two occurences. The default property value is 1.

  • Finally, add the appointment to the Scheduler.
C#

this.viblendScheduler.Appointments.Add(lunchBreak);

VB .NET

Me.viblendScheduler.Appointments.Add(lunchBreak)

About the author

Some text that describes me

Tag cloud

Recent comments

Comment RSS
Copyright © 2011 VIBlend  
ALL RIGHTS RESERVED  
 
Terms of Use | Privacy Policy
WinForms Controls Purchase Online About Us
       
DataGrid Navigation Pane Technical Support Blog
ScrollBar TreeView
ListBox ProgressBar Downloads Register
ComboBox Buttons
TabControl Editors Documentation Client Login

VIBlend Blog is powered by BlogEngine.NET