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)
 

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 Controls for Silverlight v5.0 released with 2 new controls

by viblend 24. May 2011 22:19

We are happy to announce that the new version of VIBlend Controls for Silverlight was just released with 2 new controls - Scheduler and Child Window. The Scheduler control provides the easiest way to integrate rich scheduling and calendar fuctionality in your Silverlight applications. It supports 4 different and fully customizable views - Day View, Week View, WorkWeek View and Month View. as well as data binding capabilities, recurring appointmens, edit dialogs and much more. More information about this control is available on its official page.



The ChildWindow control allows you to display a modal or non-modal popup in your Silverlight applications. When the window is opened in a modal mode, the end-users cannot access any part of the interface outside of the dialog.
The default mode of the control enables the end-users to access the application's user interface.

 If you want to check out the latest release, it is now available for download.

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.

Using a Context Menu with a TreeView

by viblend 14. November 2010 01:44

This blog post demonstrates how to capture the right click event on a tree view in order to display a context menu.

At first, we need to drag and drop a new instances of the TreeView and ContextMenu controls from the Visual Studio 2010 Toolbox.


 

The xaml markup is shown below:

<UserControl x:Class="TreeViewContextMenu.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:viblendTreeView="clr-namespace:VIBlend.Silverlight.Controls;assembly=VIBlend.Silverlight.TreeView" xmlns:viblendMenu="clr-namespace:VIBlend.Silverlight.Controls;assembly=VIBlend.Silverlight.Menu">

    <Grid x:Name="LayoutRoot" Background="White">
        <viblendTreeView:TreeView Height="250" HorizontalAlignment="Center"  Name="treeView1" VerticalAlignment="Center" Width="200">
            <viblendTreeView:TreeViewItem DisplayValue="Tree Item 1" IsExpanded="True">
                <viblendTreeView:TreeViewItem DisplayValue="Tree Sub Item 1" />
                <viblendTreeView:TreeViewItem DisplayValue="Tree Sub Item 2" />
                <viblendTreeView:TreeViewItem DisplayValue="Tree Sub Item 3" />
            </viblendTreeView:TreeViewItem>
            <viblendTreeView:TreeViewItem DisplayValue="Tree Item 2" />
        </viblendTreeView:TreeView>
        <viblendMenu:ContextMenu HorizontalAlignment="Left"  Name="contextMenu1" VerticalAlignment="Top">   
            <viblendMenu:MenuItem Click="AddItem_Click" Text="Add" />
            <viblendMenu:MenuItem Click="RemoveItem_Click" Text="Remove" />
            <viblendMenu:MenuItem Click="DisplayItem_Click" Text="Disable" />
         </viblendMenu:ContextMenu>
    </Grid>
</UserControl>

Then we need to subscribe to the MouseRightButtonDown event and we can do this either in the xaml markup or in code-behind:

C#

this.MouseRightButtonDown += new MouseButtonEventHandler(MainPage_MouseRightButtonDown); 

VB .NET

AddHandler MouseRightButtonDown, AddressOf MainPage_MouseRightButtonDown

After we subscribe to the MouseRightButtonDown event, we should implement its event handler. In the event handler, we display the ContextMenu control on the position where the right mouse button is clicked.

C#

void MainPage_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
   Point point = e.GetPosition(this.treeView1);
   if (point.X >= 0 && point.X <= this.treeView1.Width)
   {
       if (point.Y >= 0 && point.Y <= this.treeView1.Height)
       {
           Point contextMenuLocation = e.GetPosition(this);
           this.contextMenu1.Open(contextMenuLocation);
           e.Handled = true;
       }
   }
}

VB .NET

Private Sub MainPage_MouseRightButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
   Dim point As Point = e.GetPosition(Me.treeView1)
   If point.X >= 0 AndAlso point.X <= Me.treeView1.Width Then
      If point.Y >= 0 AndAlso point.Y <= Me.treeView1.Height Then
          Dim contextMenuLocation As Point = e.GetPosition(Me)
          Me.contextMenu1.Open(contextMenuLocation)
          e.Handled = True
       End If
   End If
End Sub

Finally, we implement the event handlers that will add, remove and disable TreeViewItem objects.

C#

private void AddItem_Click(object sender, EventArgs e)
{
    if (this.treeView1.SelectedItem != null)
    {
        TreeViewItem item = new TreeViewItem("New Item");
        this.treeView1.SelectedItem.Items.Add(item);
    }
}

private void RemoveItem_Click(object sender, EventArgs e)
{
    if (this.treeView1.SelectedItem != null)
    {
        if (this.treeView1.SelectedItem.ParentTreeViewItem != null)
        {
            this.treeView1.SelectedItem.ParentTreeViewItem.Items.Remove(this.treeView1.SelectedItem);
        }
        else if (this.treeView1.Items.Contains(this.treeView1.SelectedItem))
        {
            this.treeView1.Items.Remove(this.treeView1.SelectedItem);
        }
    }
}

private void DisableItem_Click(object sender, EventArgs e)
{
    if (this.treeView1.SelectedItem != null)
    {
        this.treeView1.SelectedItem.IsEnabled = false;
    }
}

VB .NET

Private Sub AddItem_Click(ByVal sender As Object, ByVal e As EventArgs)
    If Me.treeView1.SelectedItem IsNot Nothing Then
        Dim item As New TreeViewItem("New Item")
        Me.treeView1.SelectedItem.Items.Add(item)
    End If
End Sub

Private Sub RemoveItem_Click(ByVal sender As Object, ByVal e As EventArgs)
    If Me.treeView1.SelectedItem IsNot Nothing Then
        If Me.treeView1.SelectedItem.ParentTreeViewItem IsNot Nothing Then
            Me.treeView1.SelectedItem.ParentTreeViewItem.Items.Remove(Me.treeView1.SelectedItem)
        ElseIf Me.treeView1.Items.Contains(Me.treeView1.SelectedItem) Then
            Me.treeView1.Items.Remove(Me.treeView1.SelectedItem)
        End If
    End If
End Sub

Private Sub DisableItem_Click(ByVal sender As Object, ByVal e As EventArgs)
    If Me.treeView1.SelectedItem IsNot Nothing Then
        Me.treeView1.SelectedItem.IsEnabled = False
    End If
End Sub

Here is the result:

First Look at the new themes for Silverlight

by viblend 29. October 2010 07:24

We are coming close to yet another big release of VIBlend Controls for Silverlight. In the last 2 months, we spent much time on samples, themes and documentation. With the new release you will get 4 new themes for all of our controls.




Another highly anticipated addition to our DataGrid control is the enhanced cells and headers styling.



We will be glad to hear your comments or ideas about what can be improved in our Silverlight suite, so that it may be further extended and enabled with useful features.

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 support@viblend.com about what can be improved and added to it.

How to bind the VIBlend DataGrid for Silverlight and WPF to Indexed properties?

by viblend 3. September 2010 19:48

In order to bind the VIBlend DataGrid to indexed properties, you need to do the following:

1. Create DataTemplates that are bound to indexed properties.

        <DataTemplate x:Key="LastNameCellTemplate">
            <Grid>
                <TextBlock Text="{Binding [LastName], Mode=OneWay}"/>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="FirstNameCellTemplate">
            <Grid>
                <TextBlock Text="{Binding [FirstName], Mode=OneWay}"/>
            </Grid>
        </DataTemplate>

2. Create a new DataGrid instance. Set the CellDataTemplate property of the DataGrid’s BoundFields to point to the DataTemplates.

        <viblend:DataGrid x:Name="dataGrid" Width="400" Height="280" AutoGenerateColumns="True">
            <viblend:DataGrid.BoundFields>
                <viblend:BoundField Text="FirstName" Width="150" CellDataTemplate="{StaticResource FirstNameCellTemplate}"/>
                <viblend:BoundField Text="LastName" Width="150" CellDataTemplate="{StaticResource LastNameCellTemplate}"/>
            </viblend:DataGrid.BoundFields>
        </viblend:DataGrid>

3.  Create a new class that will represent a single record of the DataGrid.

CSharp

public class Person : INotifyPropertyChanged
{   
    public Person()
    {
    }

    private Dictionary<string, object> data = new Dictionary<string, object>();

    public object this[string key]
    {
        get
        {
            if (!data.ContainsKey(key))
            {
                data[key] = null;
            }
            return data[key];
        }
        set
        {
            data[key] = value;
            if (this.PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(""));
            }
        }
    }

    public IEnumerable<string> Keys
    {
        get
        {
            return data.Keys;
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}

VB .NET

Public Class Person
    Implements INotifyPropertyChanged
    Public Sub New()
    End Sub

    Private data As Dictionary(Of String, Object) = New Dictionary(Of String, Object)()

    Default Public Property Item(ByVal key As String) As Object
        Get
            If (Not data.ContainsKey(key)) Then
                data(key) = Nothing
            End If
            Return data(key)
        End Get
        Set(ByVal value As Object)
            data(key) = value
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(""))
        End Set
    End Property

    Public ReadOnly Property Keys() As IEnumerable(Of String)
        Get
            Return data.Keys
        End Get
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler
End Class

4.  Create a new generic List of Person objects and set the ItemsSource property of the DataGrid, in order to bind it to the list.

CSharp

       List<Person> listOfPersons = new List<Person>();
       for (int i = 0; i < 10; i++)
       {
           Person person = new Person();
           person["FirstName"] = "FirstName" + i;
           person["LastName"] = "LastName" + i;
           listOfPersons.Add(person);
       }
       this.dataGrid.ItemsSource = listOfPersons;

VB .NET

      Dim listOfPersons As List(Of Person) = New List(Of Person)()
      For i As Integer = 0 To 9
         Dim person As New Person()
         person("FirstName") = "FirstName" & i
         person("LastName") = "LastName" & i
         listOfPersons.Add(person)
      Next i
      Me.dataGrid.ItemsSource = listOfPersons

VIBlend Controls for Silverlight ver. 2.6 - Released

by viblend 21. June 2010 20:37

VIBlend is pleased to announce the immediate availability of VIBlend Controls for Silverlight ver. 2.6. The new version includes several important updates to the company's Silverlight suite.

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

  • Visual Studio 2010 toolbox integration
  • Right Click support in DataGrid
  • DataGrid sorting and filtering using a Context Menu
  • DataGrid performance optimizations
  • Improved DataGrid Office2010 themes
  • Turned off DataGrid deferred scrolling feature by default.
  • Fixed a design time issue in the Menu control.
  • Fixed a design time issue in the TreeView control.
  • Fixed a Stretch alignment issue in the DataGrid control.

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