VIBlend
Home Products Downloads Purchase Support Forum About Blog

Improved filtering capabilities in the new VIBlend WPF DataGrid

by viblend 19. March 2011 22:47

The new release of VIBlend Controls for WPF is almost here and we wanted to share with you some additional details about it. One of the major changes in the new version will be the updated WPF
DataGrid
Filtering functionality. The DataGrid filtering window will be extended by providing an easier and user-friendly experience. The new filtering window will show a checked list box, allowing for single
and/or multiple selections. The previous filtering mechanism will still be available and you will be able to switch to it by clicking a single button. The Grouping Panel which is already available in our WinForms
and Silverlight grid controls is coming to the WPF DataGrid, too. This new feature allows you to drag a column header to the panel above the grid to group the data. You can also programmatically group data
by using intuitive API. Data can be grouped by single or multiple columns at the same time. It is needless to say that the API of our WPF and Silverlight Data Grid controls will still be fully compatible.

 

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

 

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 

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