Showing posts with label Telerik. Show all posts
Showing posts with label Telerik. Show all posts

Friday, November 19, 2010

RadTreeView - The FindByTextCommand

RadTreeView provides a command called FindByTextCommand. The command looks for nodes which have the same Text property as the specified command parameter.

Here is an example of how to use the FindByTextCommand:

[C#] Using the FindByTextCommand
Telerik.WinControls.Commands.FindByTextCommand cmd = new FindByTextCommand();
List<object> result = RadTreeView.ExecuteBatchCommand(this.radTreeView1.Nodes, -1, cmd, "MyNode");
if(result != null)
{
  // Found nodes.
} 

[VB] Using the FindByTextCommand
Dim cmd As Telerik.WinControls.Commands.FindByTextCommand = New Telerik.WinControls.Commands.FindByTextCommand
Dim result As List(Of Object) = RadTreeView.ExecuteBatchCommand(Me.RadTreeView1.Nodes, -1, cmd, "MyNode")
If Not result Is Nothing Then
   'Found nodes.
End If 

Dev ComponentsRadControls for WinFormsTelerik Windows Forms RadTreeView

Source of Information :  2002-2010 Telerik. All Rights Reserved. Help
read more...

RadTreeView Commands Overview

RadTreeView implements the Command pattern which allows adding functionality, which operates on RadTreeNodes, without needing to modify the code of RadTreeView. This makes it easy for developers to create their own commands should they find that the commands, which RadTreeView provides, are insufficient.

RadTreeView exposes two methods with two overloads each, which accept commands to execute. The methods are called ExecuteScalarCommand() and ExecuteBatchCommand(). The difference between those two methods is that ExecuteScalarCommand() works on a single RadTreeNode whereas ExecuteBatchCommand() works on many nodes. For example, if a command which searches for a node with specific text, is passed to ExecuteScalarCommand() only one node will be found and returned. Passing it to ExecuteBatchCommand will find all nodes that have this text and return all of them. The methods return object and List<Object> (List (Of Object) in VB) which means that commands are not required to return RadTreeNodes. For example you can search for nodes and when they are found, custom objects may be created and returned. This capability will be discussed in the Implementing Custom Commands topic.

Here is an abstract example of how commands are used with RadTreeView.

[C#]
Command cmd = new Command();
List<object> result = RadTreeView.ExecuteBatchCommand(nodeCollection, -1, cmd, commandParam1, commandParam2);
if(result != null)
{
// Found nodes.
} 

[VB]
Dim cmd As Command = New Command
Dim result As List(Of Object) = RadTreeView.ExecuteBatchCommand(nodeCollection, -1, cmd, commandParam1, commandParam2)
If Not result Is Nothing Then
'Found nodes.
End If 

The example above creates a Command object and passes it to the ExecuteBatchCommand() method of RadTreeView. The method accepts a node collection on which the command will be executed, the nesting level of the nodes which will be affected, the command object and parameters which the particular command accepts. The level in this case is -1 which indicates that the whole node hierarchy will be affected by the command.

The ExecuteScalarCommand() method is used in the exact same way with the difference that it affects only one node, and only one node is returned.

Dev ComponentsRadControls for WinFormsTelerik Windows Forms RadTreeView

Source of Information :  2002-2010 Telerik. All Rights Reserved. Help
read more...

Telerik RadTreeView Key Features

Telerik RadTreeView is the supercharged tree view component for Windows Forms. It facilitates display, management, and navigation of hierarchical data structures. The product offers many advanced features like drag-and-drop, load on demand, context menus and data binding. RadTreeView features an extremely rich API, allowing you to achieve complex behavior in your applications. The skinning support nicely blends RadTreeView into the interface of your application.


» Drag & drop
RadTreeView supports drag and drop within the same tree and between RadTreeView controls. The position indication cursor provides feedback to the user so that nodes can be dropped above, below or within a given node. When dragging to a hidden or collapsed node the control will scroll up/down and automatically open the collapsed node. Drag and drop behavior is customizable at the treeview and node levels, allowing you to restrict interactions between source and target nodes.


» Rich styling capabilities
RadTreeView uses the innovative theming mechanism that the Telerik Presentation Framework (TPF) provides. You can build your own themes interactively using the Theme Builder or select one of the ready-to-use skins, including Office 2007 and Windows Vista.


» Load on demand
For industrial strength applications with heavy data requirements, the Load On Demand feature reduces loading time and performance overhead.


» Rich data binding support
RadTreeView binds to hierarchical data for most popular databases, custom business objects and XML. RadTreeView binds to any object that supports IList, IListSource or IBindingList. RadTreeView can also load and save XML directly to file or string.


» Context menus
Expand RadTreeView functionality by adding context menus either for the entire treeview or to each node. You have the capability to attach a different context menu to each tree node. Each context menu can be individually styled.


» Incremental Search
RadTreeView supports incremental search, i.e locating nodes as you type the initial characters of the node's text. This enables users to locate desired nodes quickly when the treeview has a large number of nodes.


» Multiple selection
RadTreeView allows multiple items to be selected using the Shift and Ctrl keys. Multiple selections can be dragged and dropped and can also be iterated programmatically.


» Tri state check boxes
Check boxes can have a third "indeterminate" state to provide feedback to the user. For example the screenshot below shows "Node1" in an indeterminate state to show the user that not all child nodes are checked.


» Mixed Check Boxes and Radio Buttons


» Custom node drawing
The DrawNode event allows a completely custom graphic representation of each node. A graphics object passed to the event handler provides a rich set of methods and properties.


» RTL Support
RadTreeView supports right-to-left layout and can be used in multilingual applications.


» Rich design time environment
The RadTreeView Property Builder provides a quick, intuitive way to work with treeview and nodes. A preview window displays instant feedback and an Expert Mode allows maximum control.

Dev ComponentsRadControls for WinFormsTelerik Windows Forms RadTreeView

Source of Information :  2002-2010 Telerik. All Rights Reserved. Help
read more...

Thursday, November 18, 2010

RadGridView Logical vs. Visual Grid Structure

The grid can be thought of in terms of both logical and visual. The logical layer allows you to traverse grid meta data and data, i.e. templates, groups, columns, rows and cells. The visual aspect of the grid deals with the Telerik Presentation Foundation (TPF) elements that are drawn on the screen. RadGridView events such as CellFormatting allow you to manipulate the visual aspect of the grid.

Logical Grid Structure
RadGridView has a logical structure that uses collections of objects such as GridViewRowInfo and GridViewCellinfo to represent elements of the grid. The outline below shows the general structure of the logical layer:

GridViewTemplate (MasterGridViewTemplate)
- RootGroup (RootGroups)
   - Rows (GridViewRowInfo)
   - Groups (DataGroup)
- Columns (GridViewColumn, GridViewDataColumn)
- Rows (GridViewRowInfo)
- ChildGridViewTemplates (ChildGridViewTemplates[])

Where hierarchical data is shown in the grid, the structure changes slightly:

GridViewTemplate
- RootGroup (contains many root groups - one for each row of the parent template)
   - Rows
   - Groups
- Columns
- Rows


This logical tree structure allows you to traverse down through the cell level using RadGridView collections. For example, to traverse starting at the MasterGridViewTemplate rows and through every cell to perform some arbitrary operation:

[C# ] Traversing Rows and Cells
foreach (GridViewRowInfo rowInfo in radGridView1.MasterGridViewTemplate.Rows)
{
   foreach (GridViewCellInfo cellInfo in rowInfo.Cells)
   {
       cellInfo.Value = "Test";
   }
} 
 
[VB] Traversing Rows and Cells
For Each rowInfo As GridViewRowInfo In radGridView1.MasterGridViewTemplate.Rows
 For Each cellInfo As GridViewCellInfo In rowInfo.Cells
  cellInfo.Value = "Test"
 Next
Next 

...or to iterate all the columns of each child template within the master template:

[C#] Traversing Templates and Columns
foreach (GridViewTemplate childTemplate in radGridView1.MasterGridViewTemplate.ChildGridViewTemplates)
{
   foreach (GridViewColumn column in childTemplate.Columns)
   {
       column.HeaderTextAlignment = ContentAlignment.TopCenter;
   }
} 

[VB] Traversing Templates and Columns
For Each childTemplate As GridViewTemplate In radGridView1.MasterGridViewTemplate.ChildGridViewTemplates
 For Each column As GridViewColumn In childTemplate.Columns
  column.HeaderTextAlignment = ContentAlignment.TopCenter
 Next
Next 



Visual Grid
RadGridView uses virtualization for its visual elements. This means that only the rows that are currently visible have a visual element. When the grid is scrolled up and down the visual elements are reused. For example, because of the virtualization, the CellElement can only be used inside the CellFormatting event and only for the current cell. The CellFormatting event is fired every time when the cell's visual state needs to be updated.

RadGridView has several events that allow you to access the visual elements of the grid: CreateCell, CellPaint, RowPaint, CellFormatting and RowFormatting. These events pass references to TPF elements that represent rows and cells. For example, the abbreviated example below adds a RadProgressBarElement to cell elements in the grid (see Adding Custom Elements to Cells for the full example).

[C#] Handling the CellFormatting Event
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
   RadProgressBarElement element = new RadProgressBarElement();
   e.CellElement.Children.Add(element);
} 

[VB] Handling the CellFormatting Event
Private Sub radGridView1_CellFormatting(ByVal sender As Object, ByVal e As CellFormattingEventArgs)
 Dim element As New RadProgressBarElement()
 e.CellElement.Children.Add(element)
End Sub 

Dev ComponentsRadControls for WinFormsTelerik Windows Forms RadGridView

Source of Information :  2002-2010 Telerik. All Rights Reserved. Help
read more...

Wednesday, November 17, 2010

Overview of RadGridView Structure

Row
Each row in RadGridView is represented by GridRowElement class.

HeaderRow
The header element is represented by GridHeaderRowElement class.

Add New Row
Depending on the value of GridViewTemplate.AddNewRowPosition property, the new row element appears below the header row or after the data rows.

FilteringRow
FilteringRow appears automatically when you have Filtering enabled by setting RadGridView.EnableFiltering or GridViewTemplate.EnableFiltering properties.

GridViewIndentColumn
This column appears when the grid data is grouped or there is a hierarchical structure to facilitate the expand/collapse functionality. The expand column is always placed in front of all other grid content columns and cannot be moved.

GridViewDataColumn
Displays a column bound to a field in a data source.

MasterViewTemplate
MasterViewTemplate is the top most GridViewTemplate in the hierarchical structure. It contains all inner GridViewTemplates(GridViewTemplate.ChildGridViewTemplates collection). When there is no hierarchical structure, only MasterGridViewTemplate is displayed.

GridViewTemplate
GridViewTemplate is a basic class containing settings for a single level of the hierarchical structure.

ScrollBars
RadGrid will automatically show and hide scrollbars as needed.

GroupPanel
When you want to enable the group-by functionality for the end-user, you need to set RadGridView.GroupingEnabled to true and GridViewTemplate.EnableGrouping. If you want to prevent the end-user to drag column header into the GroupPanel, set GridViewTemplate.AllowDragToGroup to false. RadGridView.ShowGroupPanel shows/hides the group panel. You can access the group panel using RadGridView.GridElement.HeaderElement.GroupPanel property.
 
Dev ComponentsRadControls for WinFormsTelerik Windows Forms RadGridView

Source of Information :  2002-2010 Telerik. All Rights Reserved. Help
read more...

Telerik RadGridView Key Features

RadGridView is a grid component developed on top of Telerik Presentation Framework which provides a combination of performance, extensibility, customizability, and ease of use.


RadGridView Key Features
1. Hierarchical data presentation - RadGridView has the ability to represent hierarchical master-detail data. Its hierarchical schema could be set up either at design-time, at runtime using the control API, or handled automatically for you based on the structure of the data.

Easily customizable theming mechanism - RadGridView is shipped with a consistent set of themes that allow you to easily build slick interfaces. Or you can use the codeless visual approach to build a new custom theme.


2. Grouping - RadGridView allows easy implementation of multilevel grouping of data from a single table. Simply drag the column header(s) to the group panel on the top to define the grouping order and hierarchy. You can also programmatically group data using group-by expressions. Another unique feature is the ability to sort grouped data by single or multiple columns. Grouping programmatically also allows you to perform aggregate operations (e.g. sum, min, max, count, first and last) and to output custom formatted strings into the group heading.


3. Multi-column sorting - in addition to the simple one-column sorting RadGridView allows you to sort data by several columns just like in Microsoft Excel. With the help of sorting expressions, you can also do custom sorting.


4. Filtering - RadGridView can perform filtering operations for all columns that support filtering. For each column there will be a dropdown menu with the available filter expressions.


5. Column resizing - RadGridView supports convenient column and row resizing providing the following key features:
» real-time resizing
» best fit sizing
» resizing of the grid on column/row resizing
» clipping of the cell content on column resizing


6. Column reordering with drag-and-drop - column reordering is a nice interface feature which lets users reorder columns, based on their personal preference. Telerik RadGridView allows users to quickly reorder columns at Run Time by simply draging and dropping their headers, with a visual indication of the header being dragged.


7. Keyboard navigation - RadGridView can be navigated using the keyboard. You can focus on a grid with the TAB key, navigate through the rows, and edit cells.


8. Rich set of column types - RadGridView supports the most commonly used column types to provide editing functionality.


9. Pinned rows and Pinned columns support - RadGridView enhances the simple scrolling by supporting pinned rows and columns. You can scroll the grid data, while pinned rows stay visible and next to header row; pinned columns stay visible and on the left of the grid. Ability to use other Telerik elements as editors - This feature gives you extra flexibility in building functionality into applications and allows you to add new custom editors (RadComboBoxElement, RadTextBoxElement, RadButtonElement, RadProgressBarElement, etc).


10. DataBinding to business objects, nullable objects and properties of sub-objects – You can use a wide variety of data-sources for grid structure generation (the only requirement is that these custom objects implement the ITypedList/IEnumarable/ICustomTypeDescriptor interfaces). Furthermore, RadGridView supports out-of-the-box binding to sub-objects, nullable and business objects.


11. Conditional formatting - RadGridView enables you to apply conditional formatting to grid elements for enhanced readability and usability of the displayed data. Conditional formatting can be applied programmatically or by the user at run-time.


12. Context menu support - The context menu provides extra usability and richness to any application. The default RadGridView context menu provides support for sorting, formatting, grouping, column selection and automatic column width adjustment. You can extend the context menu to add your own menu items and display your menus conditionally.

Dev ComponentsRadControls for WinFormsTelerik Windows Forms RadGridView

Source of Information :  2002-2010 Telerik. All Rights Reserved. Help
read more...