Skip to main content

Posts

Showing posts from January, 2012

WPF Multiline Textbox

For Multiline  in TextBox we can use a TestBox Like this We can make a TextBox Control that will support Multiline  by using 2 properties. TextWrapping="Wrap" and AcceptsReturn="True" The XAML code for this TextBox <TextBox Height="131" HorizontalAlignment="Left" Margin="6,6,0,0" Name="educationalInformationTextBox" VerticalAlignment="Top" Width="345" TextWrapping="Wrap" AcceptsReturn="True" />

WPF Tab Control Navigation

 Most of time in Tab Control we want navigate one tab to another tab without clicking the tab header. Go to next tab. Back to the previous tab. it's easy, in your event just use tabname.selected= true. private void empInformationBackButton_Click(object sender, RoutedEventArgs e) { tabItemPersonalInfo.IsSelected = true; }

WPF DataGrid XAML Binding

DataGrid in one of the powerfull control in WPF. we can easily load our Datagrid if we bind the DataGrid with our Class property. consider the DataGrid. To bind this DataGrid i have use this class & hare i also Implement INotifyPropertyChanged property for datagrids cell property change event. hare Apv from & Apv To Datepicker change event will change the value of Apv Days. public class ELeaveApprove : INotifyPropertyChanged { public long Appr_LeaveId { get; set; } public string Appr_LeaveType { get; set; } public int? Appr_RemainLeave { get; set; } public DateTime Appr_FromDate { get; set; } public DateTime Appr_ToDate { get; set; } public string Appr_Action { get; set; } public long Appr_EmpId { get; set; } public int? Apply_Day { get; set; } public string Appr_Status { get; set; } private int apvNoOfdays; public string Emp_Name { get; set; } public string Emp_Department {

Google style Searching in WPF

Hi,        In your WPF application you can use search style like as google. Like the images when you are type in a Textbox  for search. and your matching data will load in Employee list: this can be done on Textchange event. hare i use textbox for type, listbox for load type matches data & the Listview for displaying the final data. Text Change Event: private void searchEmployeeCodeTextBox_TextChanged(object sender, TextChangedEventArgs e) { employesLstView.Items.Clear(); if (searchEmployeeCodeTextBox.Text != "") { empObj.EmployeeCode = searchEmployeeCodeTextBox.Text.Trim(); List<EEmployeeInfo> employeeInfos = new List<EEmployeeInfo>(); employeeInfos = bEmployeeObj.listshowEmployeeCodeWise(empObj); if (employeeInfos.Count > 0) { if (employeeInfos.Count != 1) { employeeCodeListBox.Visibility = Visibility.Visibl

Auto Custome ID Generation from SQL Table

Hi, if you have a table which contain a Id field. Such like "10001" If you want to Custom the ID like "EM00001" you can easily manage it using store procedure. Consider the store Procedure: USE [HRMDB] GO /****** Object: StoredProcedure [dbo].[NEW_EMP_CODE_CREATION] Script Date: 01/10/2012 19:09:58 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[NEW_EMP_CODE_CREATION] AS BEGIN SET NOCOUNT ON DECLARE @empID_ID VARCHAR(20), @countRow INT SELECT @countRow=COUNT(*) FROM EMPLOYEE_INFORMATION IF(@countRow<>0) BEGIN DECLARE @num int SELECT @num=(max(CONVERT(int, SUBSTRING( EMP_CODE,3,8)))+1) FROM EMPLOYEE_INFORMATION SET @empID_ID=(SELECT Distinct('EM'+RIGHT ('000000'+ CAST(@num as varchar), 6)) FROM EMPLOYEE_INFOR

WPF Popup Window

Hi,      we can use a WPF Popup window using show dialogBox. Hope code will be clear to you. // Main window any event private void LoadListOfEmployee() { // Pop Up window open PopUpEmployeeInfoList objPopupEmployeeList = new PopUpEmployeeInfoList(); if (objPopupEmployeeList.ShowDialog() == true) { EEmployeeInfo eEmoloyeeInfoObj = new EEmployeeInfo(); // Casting Popup window data eEmoloyeeInfoObj = objPopupEmployeeList.employesLstView.SelectedItem as EEmployeeInfo; // Setting popupwindow data to main window control textEmployeeCode.Text = eEmoloyeeInfoObj.EmployeeCode; tenureEmployeeCodeTextBox.Text = eEmoloyeeInfoObj.EmployeeCode; releaseEmployeeCodeTextBox.Text = eEmoloyeeInfoObj.EmployeeCode; } } // Pop Up window Event // using this.DialogResult = true; popup window replace the contro