VIBlend
Home Products Downloads Purchase Support Forum About Blog

Creating Rows and Columns Hierarchies in Unbound Mode

by viblend 3. April 2012 16:46

In this post, we will show you how to create rows and column hierarchies in unbound mode and fill the DataGrid cells with data. In order the add Columns in unbound mode, you should use the DataGrid.ColumnsHierarchy.Items.Add method. To add rows in unbound mode, use the DataGrid.RowsHierarchy.Items.Add method. The 'Add' method returns a HierarchyItem object. This allows you to add sub-items to the HierarchyItem because it has Items.Add method, too.

The code below creates a 2-level Rows Hierarchy and can be used with the VIBlend DataGrid control for Silverlight, WPF and Windows Forms. 

C#

this.DataGrid.RowsHierarchy.CompactStyleRenderingEnabled = false;
for (int i = 0; i < 10; i++)
{
    HierarchyItem row = this.DataGrid.RowsHierarchy.Items.Add("Row" + i);
    HierarchyItem column = this.DataGrid.ColumnsHierarchy.Items.Add("Column" + i);

    for (int j = 0; j < 3; j++)
    {
        HierarchyItem subRow = row.Items.Add("Row" + i + "." + j);
    }
}
  
VB .NET

Me.DataGrid.RowsHierarchy.CompactStyleRenderingEnabled = False
For i As Integer = 0 To 9
    Dim row As HierarchyItem = Me.DataGrid.RowsHierarchy.Items.Add("Row" & i)
    Dim column As HierarchyItem = Me.DataGrid.ColumnsHierarchy.Items.Add("Column" & i)

    For j As Integer = 0 To 2
        Dim subRow As HierarchyItem = row.Items.Add("Row" & i + AscW("." )+ j)
    Next j
Next i

To Fill the DataGrid with data in unbound mode, you should use the DataGrid.CellsArea.SetCellValue method. The method accepts three parameteres - row, column and the cell value.

C#

for (int i = 0; i < 10; i++)
{
    HierarchyItem row = this.DataGrid.RowsHierarchy.Items[i];
    for (int j = 0; j < 10; j++)
    {
        HierarchyItem column = this.DataGrid.ColumnsHierarchy.Items[j];
        this.DataGrid.CellsArea.SetCellValue(row, column, "Cell" + i + "." + j);
        for (int p = 0; p < 3; p++)
        {
            this.DataGrid.CellsArea.SetCellValue(row.Items[p], column, "Cell" + p + "." + j);             
        }
    }
}
       
this.DataGrid.RowsHierarchy.ExpandAllItems();
this.DataGrid.ColumnsHierarchy.ExpandAllItems();
this.DataGrid.RowsHierarchy.AutoResize(AutoResizeMode.FIT_ALL);
this.DataGrid.ColumnsHierarchy.AutoResize(AutoResizeMode.FIT_ALL);
  
VB .NET

For i As Integer = 0 To 9
    Dim row As HierarchyItem = Me.DataGrid.RowsHierarchy.Items(i)
    For j As Integer = 0 To 9
        Dim column As HierarchyItem = Me.DataGrid.ColumnsHierarchy.Items(j)
        Me.DataGrid.CellsArea.SetCellValue(row, column, "Cell" & i + AscW("." )+ j)
        For p As Integer = 0 To 2
            Me.DataGrid.CellsArea.SetCellValue(row.Items(p), column, "Cell" & p + AscW("." )+ j)
        Next p
    Next j
Next i

Me.DataGrid.RowsHierarchy.ExpandAllItems()
Me.DataGrid.ColumnsHierarchy.ExpandAllItems()
Me.DataGrid.RowsHierarchy.AutoResize(AutoResizeMode.FIT_ALL)
Me.DataGrid.ColumnsHierarchy.AutoResize(AutoResizeMode.FIT_ALL)

VIBlend WPF Controls ver. 4.5.0 - Released

by viblend 15. August 2011 21:34

We are happy to announce the availability of VIBlend WPF Controls ver. 4.5.0.

What's New:

New: DataGrid data binding to sub properties.
Improved DataGrid multiple cells selection.
Improved DataGrid keyboard navigation.
Improved DataGrid editing logic in unbound mode.
Improved DataGrid cell templates support.

What's Fixed:

Fix: resolved an issue regarding the DataGrid cell editors.
Fix: resolved an issue regarding the DataGrid selection border.
Fix: resolved an issue regarding the DataGrid Pivot Design Panel.
Fix: resolved an issue regarding the DataGrid Dispose logic.
Fix: resolved an issue regarding the localization of the DataGrid's Filtering Window.
Fix: resolved an issue regarding the DataGrid Columns Auto-Size behavior.
Fix: resolved an issue regarding the Numeric Editors Validation.
Fix: resolved an issue regarding the ComboBox data binding.
Fix: resolved an issue regarding the ComboBox selection.

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

New Pivot Table aggregation functions coming to VIBlend WPF DataGrid

by viblend 10. March 2011 02:59

We are adding several important pivot tables improvements in VIBlend WPF DataGrid. The upcoming release will feature four additional data aggregation functions: StDev, StDevP, Var and VarP. The StDev function calculates the standard deviation on a sample of values while the StDevP function calculates it on the entire population of values. The Var and VarP functions calculate the variance on a sample of values and on the entire population. With these new functions you will be able to load the WPF DataGrid with a set of data records, pivot by any column and see the aggregated results. All this can be expressed entirely in XAML:

  <viblend:DataGrid
    AutoGenerateColumns="True"
    PivotValuesOnRows="False"
    x:Name="pivotGrid1" >
       <viblend:DataGrid.BoundPivotRows>
      <viblend:BoundField Text="Country" DataField="Country"/>
      <viblend:BoundField Text="Region" DataField="Region"/>
      <viblend:BoundField Text="City" DataField="City"/>
    </viblend:DataGrid.BoundPivotRows>
    <viblend:DataGrid.BoundPivotColumns>
      <viblend:BoundField Text="Shipping Company" DataField="ShipperCompany"/>
    </viblend:DataGrid.BoundPivotColumns>
    <viblend:DataGrid.BoundPivotValues>
      <viblend:BoundValueField
        Text="Count"
        DataField="ExtendedPrice"
        Function="Count"/>
    <viblend:BoundValueField
        Text="Sum"
        DataField="ExtendedPrice"
        Function="Sum"/>
    <viblend:BoundValueField Text="Standard Deviation"
        DataField="ExtendedPrice"
        Function="StDev"
        SortMode="Automatic"/>
    </viblend:DataGrid.BoundPivotValues>
  </viblend:DataGrid>

 

Another important key feature that you can expect in the new release is the Pivot Design Panel. The Pivot Design panel provides an intuitive and easy to use drag and drop interface for defining pivot table views. You can choose the pivot rows, pivot columns, pivot filters, data fields and data aggregation functions.  This solution is ideal for building a wide range of in-house OLAP and BI applications. The Pivot Design panel is already available in our Silverlight and Windows Forms suites.

WPF DataGrid - data binding to SQL Server Database

by viblend 21. December 2010 19:23

One of the most common data binding scenarios is to bind a DataGrid to a SQL Server Database and to load records from a specified data table. In this post, we will explain you how to set up basic data binding in VIBlend WPF DataGrid to the Customer table of the AdventureWorksLT Database.

So the first step would be to create a new WPF Application Project and then create a new instance of the DataGrid via drag and drop from the toolbox or create it programmatically. The DataGrid fields that will represent data source fields are created in XAML markup. Below you will see that we have very simple XAML for our WPF application which adds a DataGrid to the window

       <viblendDataGrid:DataGrid ItemsSource="{Binding Customer}" Name="dataGrid1" Margin="10">
            <viblendDataGrid:DataGrid.BoundFields>
                <viblendDataGrid:BoundField Text="First Name" DataField="FirstName" Width="70"/>
                <viblendDataGrid:BoundField Text="Last Name" DataField="LastName" Width="70"/>
                <viblendDataGrid:BoundField Text="Company Name" DataField="CompanyName" Width="150"/>
                <viblendDataGrid:BoundField Text="Phone" DataField="Phone" Width="100"/>
                <viblendDataGrid:BoundField Text="Email Address" DataField="EmailAddress" Width="100"/>
            </viblendDataGrid:DataGrid.BoundFields>
        </viblendDataGrid:DataGrid>

 Next, create a new AdventureWorksLTDataSet. In order to create it, do the following: Select Data->Add New DataSource->DataBase->DataSet. Add a connection to the AdventureWorksLT Database and Click the 'Next' button. Then expand the 'Tables' tree node, select Customer and click the 'Finish' button.



Note: The AdventureWorksLT Database is installed with the installation of the SQL Server. However, you can also download and install it from http://sqlserversamples.codeplex.com 
Once the Data Source is configured, create new instances of the AdventureWorksLTDataSet data set. and CustomerTableAdapter , then fill the Customer table with data. Finally, bind the VIBlend DataGrid for WPF to the Customer table.

C#

   public partial class MainWindow : Window
    {
        AdventureWorksLTDataSet dataSet = new AdventureWorksLTDataSet();
        AdventureWorksLTDataSetTableAdapters.CustomerTableAdapter adapter = new AdventureWorksLTDataSetTableAdapters.CustomerTableAdapter();
   
        public MainWindow()
        {
            InitializeComponent();
            adapter.Fill(dataSet.Customer);
            this.dataGrid1.DataContext = this;
        }

        public WpfApplication2.AdventureWorksLTDataSet.CustomerDataTable Customer
        {
            get
            {
                return this.dataSet.Customer;
            }
        }
    }

VB .NET

   Partial Public Class MainWindow
       Inherits Window
        Private dataSet As New AdventureWorksLTDataSet()
        Private adapter As New AdventureWorksLTDataSetTableAdapters.CustomerTableAdapter()

        Public Sub New()
            InitializeComponent()
            adapter.Fill(dataSet.Customer)
            Me.dataGrid1.DataContext = Me
        End Sub

        Public ReadOnly Property Customer() As WpfApplication2.AdventureWorksLTDataSet.CustomerDataTable
            Get
                Return Me.dataSet.Customer
            End Get
        End Property
   End Class

 

How to bind a WPF Pivot Grid to MS Access Database

by viblend 11. December 2010 19:58

In this post we will demonstrate you how to bind the VIBlend WPF DataGrid to "Invoices" view in the Nwind.mdb database, which is shipped with the installation. The control will be used to analyze sales per country and shippers companies.

At first you need to create a new instance of the NwindDataSet and InvoicesTableAdapter. Then you need to fill the table with data and set the DataContext property.

C#

NwindDataSet dataSet = new NwindDataSet();
InvoicesTableAdapter adapter = new InvoicesTableAdapter();
adapter.Fill(dataSet.Invoices);
this.DataContext = dataSet.Invoices;

VB .NET

Dim dataSet As New NwindDataSet()
Dim adapter As New InvoicesTableAdapter()
adapter.Fill(dataSet.Invoices)
Me.DataContext = dataSet.Invoices

The DataGrid fields that will represent data source fields are created in XAML markup. In order to format the currency data, you should specify the StringFormat property in the binding expression.

 <Window x:Class="DataBinding.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:DataBinding"
        Title="MainWindow" Height="350" Width="525" xmlns:viblendDataGrid="clr-namespace:VIBlend.WPF.Controls;assembly=VIBlend.WPF.DataGrid">
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="CellTemplate">
                <TextBlock HorizontalAlignment="Right" Text="{Binding StringFormat=C2}"/>
            </DataTemplate>
        </Grid.Resources>
        <viblendDataGrid:DataGrid ItemsSource="{Binding}" Name="dataGrid1" Margin="10">
            <viblendDataGrid:DataGrid.BoundFields>
                <viblendDataGrid:BoundField Text="Shippers Company" DataField="Shippers_CompanyName"/>
                <viblendDataGrid:BoundField Text="Country" DataField="Country"/>
                <viblendDataGrid:BoundField Text="ExtendedPrice" DataField="ExtendedPrice"/>
            </viblendDataGrid:DataGrid.BoundFields>
            <viblendDataGrid:DataGrid.BoundPivotRows>
                <viblendDataGrid:BoundField Width="100" Text="Country" DataField="Country"/>
            </viblendDataGrid:DataGrid.BoundPivotRows>
            <viblendDataGrid:DataGrid.BoundPivotColumns>
                <viblendDataGrid:BoundField Text="Shippers Company" DataField="Shippers_CompanyName"/>
            </viblendDataGrid:DataGrid.BoundPivotColumns>
            <viblendDataGrid:DataGrid.BoundPivotValues>
                <viblendDataGrid:BoundValueField CellDataTemplate="{StaticResource CellTemplate}" Text="Sum" DataField="ExtendedPrice" Function="Sum"/>
                <viblendDataGrid:BoundValueField CellDataTemplate="{StaticResource CellTemplate}" Text="Average Price" DataField="ExtendedPrice" Function="Average"/>
            </viblendDataGrid:DataGrid.BoundPivotValues>
        </viblendDataGrid:DataGrid>
    </Grid>
</Window>

Here is an image of the result:

VIBlend Controls for WPF v3.0 - Released

by viblend 5. December 2010 19:14

We are happy to announce the immediate availability of VIBlend Controls for WPF v3.0 - UI Controls for high performance, WPF user interfaces.  VIBlend Controls for WPF includes a shared API with VIBlend Controls for Silverlight and comes with fast data binding that can easily handle hundreds of thousands records.

What’s new in VIBlend Controls for WPF v3.0?

New Controls:

- TabControl, GroupBox, ColorPicker, DropDownButton, SplitButton, RadioButton, CheckBox, Button, ToggleButton, RepeatButton, ScrollViewer, LinkLabel.

Improved:

- All themes get a major facelift for greater consistency and appeal across skin elements such as headers, rows, buttons, scrollbars, selected, default, highlighted, disabled states, etc.

- DataGrid - performance optimizations, support for data binding to a DataTable, cells and headers styling, added scrolling animations, localization support, clipboard operations - Cut(CTRL + X), Copy(CTRL + C) and Paste(CTRL + V), better cells highlight functionality with ability to highlight all cells in a row or column.

New Free Themes:

- Silver, Office2007 Blue, Office2007  Black and Office2007  Silver

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

Highly optimized new version of VIBlend WPF DataGrid is almost here

by viblend 18. November 2010 23:44

The main focus of the upcoming major release is on the WPF DataGrid control. There are two main areas that were the target of improvement – performance and business-oriented features. The performance is improved in various scenarios including navigation, scrolling and data binding. You can easily create an excel-like spreadsheet with thousands of rows and columns or bind the DataGrid to large datasets. Some of the key new features will be the built-in Clipboard support, Localization Provider, enhanced Data Layer through binding to a DataTable and improved support for MVVM. 


 

If you have already worked with the VIBlend Silverlight and WinForms DataGrids, you will also benefit from the shared codebase between our DataGrid controls.

Another small improvement will be the new default theme: 



We sincerely hope that you'll like the new changes and we'll be glad to hear your feedback. If you have any questions regarding the new release, please feel free to contact us at support@viblend.com 

Code reuse in Silverlight, WPF and WinForms DataGrid

by viblend 6. November 2010 02:43

One of our main goals while developing our DataGrid controls for Silverlight, WPF and WinForms was to keep our programming model as similar as possible. The benefit of having a similar programming model is that it enables easy code reuse between multiple platforms and shortens your learning curve.

Going through an Example

Let's consider the sample application shown in Figure 1. The application presents a form with a WinForms DataGrid which is filled with data in unbound mode.


Figure 1

The sample data is shown below:

C#

        string[] firstNames = new string[]
        {
            "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylène"
        };
        string[] lastNames = new string[]
        {
            "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Björn", "Nodier"
        };
        string[] productNames = new string[]
        {
            "Black Tea", "Green Tea", "Doubleshot Espresso", "Caffè Espresso", "Caffè Latte", "White Chocolate Mocha", "Caramel Latte", "Caffè Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"
        };

VB .NET

        Dim firstNames() As String = { "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylène" }
        Dim lastNames() As String = { "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Björn", "Nodier" }
        Dim productNames() As String = { "Black Tea", "Green Tea", "Doubleshot Espresso", "Caffè Espresso", "Caffè Latte", "White Chocolate Mocha", "Caramel Latte", "Caffè Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist" }

Here is the code that loads the data into the DataGrid control:

C#

        private void LoadData(vDataGridView dataGrid)
        {
           HierarchyItem firstName = dataGrid.ColumnsHierarchy.Items.Add("First Name");
           HierarchyItem lastName = dataGrid.ColumnsHierarchy.Items.Add("Last Name");
           HierarchyItem productName = dataGrid.ColumnsHierarchy.Items.Add("Product");
           HierarchyItem date = dataGrid.ColumnsHierarchy.Items.Add("Date");
           Random random = new Random();

           for (int i = 0; i < 100; i++)
           {
               HierarchyItem row = dataGrid.RowsHierarchy.Items.Add(i.ToString());
               dataGrid.CellsArea.SetCellValue(row, firstName, firstNames[random.Next(0, firstNames.Length - 1)]);
               dataGrid.CellsArea.SetCellValue(row, lastName, lastNames[random.Next(0, lastNames.Length - 1)]);
               dataGrid.CellsArea.SetCellValue(row, productName, productNames[random.Next(0, productNames.Length - 1)]);
               dataGrid.CellsArea.SetCellValue(row, date, DateTime.Now.AddDays(i));
           }

          dataGrid.RowsHierarchy.AutoResize(AutoResizeMode.FIT_ITEM_CONTENT);
          dataGrid.ColumnsHierarchy.AutoResize(AutoResizeMode.FIT_ALL);
       }

VB .NET

        Private Sub LoadData(ByVal dataGrid As vDataGridView)
           Dim firstName As HierarchyItem = dataGrid.ColumnsHierarchy.Items.Add("First Name")
           Dim lastName As HierarchyItem = dataGrid.ColumnsHierarchy.Items.Add("Last Name")
           Dim productName As HierarchyItem = dataGrid.ColumnsHierarchy.Items.Add("Product")
           Dim [date] As HierarchyItem = dataGrid.ColumnsHierarchy.Items.Add("Date")
           Dim random As New Random()

           For i As Integer = 0 To 99
               Dim row As HierarchyItem = dataGrid.RowsHierarchy.Items.Add(i.ToString())
               dataGrid.CellsArea.SetCellValue(row, firstName, firstNames(random.Next(0, firstNames.Length - 1)))
               dataGrid.CellsArea.SetCellValue(row, lastName, lastNames(random.Next(0, lastNames.Length - 1)))
               dataGrid.CellsArea.SetCellValue(row, productName, productNames(random.Next(0, productNames.Length - 1)))
               dataGrid.CellsArea.SetCellValue(row, [date], DateTime.Now.AddDays(i))
           Next i

In the sample code, we have successfully created Rows and Columns in unbound mode and filled the WinForms DataGrid control with data. You will be able to use the same approach for both Silverlight and WPF applications.

A typical Silverlight application is built from a tree of objects where UserControl is the root of the tree. In turn, the UserControl element contains a number of child elements laid out in a variety of ways. The following markup creates a new instance of the VIBlend Silverlight DataGrid:

<UserControl x:Class="SilverlightApplication38.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:viblendDataGrid="clr-namespace:VIBlend.Silverlight.Controls;assembly=VIBlend.Silverlight.DataGrid">
    <Grid x:Name="LayoutRoot" Background="White">
        <viblendDataGrid:DataGrid Height="250" Name="dataGrid1" Width="350" />
    </Grid>
</UserControl>  

It is now time to reuse the code from our Windows Forms application and here is the result:


Figure 2

In order to port the code from the WinForms application to Silverlight and WPF, we need to change only the parameter type of the LoadData method from vDataGridView to DataGrid.

Here is the markup of our WPF application.

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" xmlns:viblend="clr-namespace:VIBlend.WPF.Controls;assembly=VIBlend.WPF.DataGrid">
    <Grid>
        <viblend:DataGrid Height="250" Name="dataGrid1" Width="450" />
    </Grid>
</Window>

In figure 3 is shown the sample application with our WPF DataGrid.

Figure 3

In summary, with a little effort you can easily create desktop applications with the VIBlend WinForms DataGrid or WPF DataGrid and convert them to Web applications running the Silverlight DataGrid.

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 WPF Controls v2.0 - Released

by viblend 10. August 2010 08:13
VIBlend  is proud to announce the immediate availability of the VIBlend WPF Controls ver. 2.0 – feature complete WPF components for Visual Studio 2008 and Visual Studio 2010. In this new release, VIBlend introduces several new controls and adds numerous new features to the existing controls.

New controls include:
  • WPF DataGrid/PivotGrid control
  • WPF OutlookPane
  • WPF NavigationPane
  • WPF ScrollablePanel
  • WPF SpinEditor
  • WPF PromptTextBox
  • WPF DateTimePicker
  • WPF CheckedListBox
Updates and new features:
  • Help Documentation
  • Editors Themes
  • Editors Data Binding capabilities
  • Editors Clipboard support
  • Editors Keyboard Navigation
  • Editors now have a built-in validation
  • DateTimeEditor now have a support for Null Values
  • VS2010 and VS2008 toolbox integration
New Themes:
  • Office2010Black
  • Office2010Blue
  • Office2010Silver
  • Office2007Blue
  • Office2007Silver
  • Office2007Black
Note: The Office2010 themes include a set of free styles for the standard WPF controls.

To download your free evaluation copy of VIBlend WPF Controls ver. 2.0, login into your account and visit our product download page at: http://www.viblend.com/downloads.aspx

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