Home Products Downloads Purchase Support Forum About Blog

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. 

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);



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

2. Create a new NumericFilter and set its ComparisonOperator and Value properties

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


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. 

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


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. 




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 ListItemType="RadioButton" DisplayValue="Inbox" Value="Inbox" ImageSource="/Images/folder.png"/>

Here's the resulting TreeView:

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.


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. 

New ChildWindow control coming to VIBlend Silverlight Controls v5.0

by viblend 21. April 2011 19:38

In the next version of VIBlend Controls for Silverlight, we will introduce a new control - Silverlight ChildWindow. The ChildWindow control allows you to direct a user’s attention to a particular activity in your application such as entering data or viewing information. This new control resembles a standard Window and can be displayed in a modal or non-modal popup. When the control is displayed in a modal mode, the interaction with the underlying user interface is blocked.

Built-In Features:

  • Animated Open and Close Effects - the window is opened and closed with a smooth animation.
  • Resizing Support - users can choose to drag edges to resize the window.
  • Modal Mode - when the window is opened in a modal mode, the end-users cannot access any part of the interface outside of the dialog.
  • Non-Modal Mode - this mode enables the end-users to access the application's user interface.
  • Startup Position - you can choose the window's startup position. By default, the window is started at the application's middle-center.
  • Minimized and Maximized states - the window can be maximized or minimized similar to the standard Windows.
  • Application Boundaries Detection - end-users cannot drag or resize the window outside of the application's boundaries.

VIBlend Controls for Silverlight v4.0.0 - Released

by viblend 2. February 2011 17:02

We are proud to announce the immediate availability of VIBlend Silverlight Controls v4.0.0 - the next generation of user interface controls for Silverlight from VIBlend.

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

  • Smooth scrolling animation in TreeView, ListBox, ComboBox and CheckedListBox,
  • DataGrid Pivot table aggregation functions - StDev, StDevP, Var, VarP ,
  • New Controls: Ribbon Bar, vScrollViewer, DataGrid Pivot Design Panel, DataGrid Grouping Panel
  • New Default Theme for all controls in the package.


To help you shorten your learning curve we improved our help documentation, provide the style definitions of our themes and the full source code in C# and VB .NET of our examples.

VIBlend Silverlight Controls v3.5 - Released

by viblend 1. November 2010 03:14

We are proud to announce the availability of VIBlend Controls for Silverlight ver. 3.5.0 - the next generation of user interface controls for Silverlight from VIBlend. Our main efforts for this release were focused on improving the DataGrid’s rendering and performance.

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

  • DataGrid performance optimizations
  • New themes for all VIBlend Controls for Silverlight
  • New controls - TabControl, Toolbar and BannerRotator
  • Design Time improvements 

To help you create themes and skins for your applications, we added a new ‘CustomTheme’ project to our installation package. This project includes C# and VB .NET samples and xaml style definitions for our controls.

  See our Silverlight Controls Live Demo and Download a free trial today.

VIBlend TabControl for Silverlight

by viblend 25. October 2010 09:41

The new version of VIBlend Silverlight Controls is coming soon.  Over the next couple of days we will share some more information about the key changes and improvements.
Based on your feedback we are adding one highly desired and very frequently used control – TabControl for Silverlight. The new control comes with all features you can expect:

  • Item Alignment 
  • Item Orientation
  • Animated Scrolling
  • Text and Image relation
  • Item Templates
  • Content Templates
  • Optional Item close buttons
  • Easy and intuitive Design-time support
  • 11 built-in themes

Here are a few screenshots of the new control:

We hope that you will like this new control.  Feel free to write us at about what can be improved and added to it.

VIBlend Silverlight Controls v3.0 - Released

by viblend 14. September 2010 20:47

VIBlend is announcing the immediate availability of the VIBlend Controls for Silverlight ver. 3.0.

With 19 new controls, Themes and enhanced functionality in the DataGrid, Menu and SpinEditor, VIBlend Controls for Silverlight empower developers to build full featured and great looking line-of-business applications.

New features:

  • Menu and ContextMenu controls now have 17 built-in Themes including Office 2010 Blue, Black and Silver and Office 2007 Blue, Black and Silver
  • DataGrid Enhancements  - The latest release introduces Export to Excel, CSV, HTML and XML.
  • 19 new editors such as ComboBox, ListBox, CheckedListBox, GroupBox, ColorPicker, RadioButton, CheckBox, Slider, Button, ToggleButton, etc.
  • Data Input Editors and NavigationPane now have an improved Data Binding capabilities.
See our Silverlight Controls Live Demo and Download a free trial today.

VIBlend Silverlight Controls - ver. 2.0 Released

by viblend 3. March 2010 05:26

We are proud to announce the second major release of VIBlend Controls for Silverlight.

With the new release, VIBlend has officially included in the suite four new controls – OutlookPane, NavigationPane, DateTimePicker and ScrollablePanel. Not only we introduced new controls, but we also improved the quality and functionality of the existing ones and added over 10 new examples to show how our controls work.

The Menu and Context Menu controls from the toolset are now provided free of charge to all registered users.

See our Silverlight Controls Live Demo and Download a free trial today.

About the author

Some text that describes me

Tag cloud

Recent comments

Comment RSS
Copyright © 2011 VIBlend  
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