Wednesday 5 June 2013

Difference between ListView and DataGrid in WPF

1- The difference between ListView and DataGrid is Editing. 
Edit allow in datagrid  but not in ListView. You can also edit in ListView, but it is easy and build in DataGrid.

2-Automatic column generation support in Datagrid only.



<DataGrid Height="200" Width="500" HorizontalAlignment="Left" Margin="12,21,0,0"
  Name="McDataGrid" VerticalAlignment="Top" RowHeight="30" ColumnWidth="100>
</DataGrid>
 


Selection Mode in DataGrid
The SelectionMode property decides if the DataGrid allows only a single row or multiple rows selection. It has two values  Single and Extended.  The following code sets the SelectionMode to Single .
SelectionMode="Single "
 

Scrolling

VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible"

Read Only
IsReadOnly="True"

All these are the property of Datagrid.  

 

Tuesday 4 June 2013

Tree View in WPF

If you want to create a simple tree View in WPF. Just add TreeView control on your page and add items in either using XAML or from code behind.

 <TreeView>
    <TreeViewItem Header="ASIA">
        <TreeViewItem Header="INDIA"></TreeViewItem>
        <TreeViewItem Header="PAKISTAN"></TreeViewItem>
        <TreeViewItem Header="SRI LANKA"></TreeViewItem>
    </TreeViewItem>
    <TreeViewItem Header="South America">
        <TreeViewItem Header="Argentina"></TreeViewItem>     
        <TreeViewItem Header="Uruguay"></TreeViewItem>
         <TreeViewItem Header="Brazil"></TreeViewItem>
 </TreeViewItem>
 </TreeView>


For more details please Visit.
http://www.c-sharpcorner.com/UploadFile/mahesh/treeview-in-wpf/

Monday 3 June 2013

Introduction to DML, DDL, DCL and TCL –

DDL
DDL (Data Definition Language). It is used to create and modify the structure of database objects in database.

Examples: CREATE, ALTER, DROP Table or database statements.



DML
DML(Data Manipulation Language). It is used to retrieve, store, modify, delete, insert and update data in  table database.

Examples: SELECT, UPDATE, INSERT statements.


TCL
TCL(Transactional Control Language). It is used to manage different transactions occurring within a database.

Examples: COMMIT, ROLLBACK statements.



DCL
DCL(Data Control Language). It is used to create roles, permissions,  to control access to database by securing it.

Examples: GRANT, REVOKE statements



Date Picker in WPF

I currently have a program that takes the value from a datePicker and have the date saved as a string. I only needed the date not the time so i used the following code to save the date value:
DateTime StartDate;
String inMyString;
savedDate = datePicker1.SelectedDate.Value.Date;
inMyString =   savedDate.Date.ToShortDateString()


<DatePicker Height="25" HorizontalAlignment="Left" Margin="42,26,0,0" Name="datePicker1"
            VerticalAlignment="Top" Width="115" />