Skip to main content

Posts

How to get WPF datagrid cell value

We can easily get the value of a WPF datagrid cell value using cast with the class. in which class the data grid is   bind. consider the code private void GetTotalGBP() { decimal dr = 0, cr = 0; for (int i = 0; i < receiveInvoiceDataGrid.Items.Count; i++) { ReceiveInvoice obj = receiveInvoiceDataGrid.Items[i] as ReceiveInvoice; TGBP += Convert.ToDecimal(obj.NetValue); // getting cell value TQTY += Convert.ToDecimal(obj.ConfirmOrderQty); // getting cell value } totalGBPTextbox.Text = TGBP .ToString("F"); totalQtyTextBox.Text = TQTY .ToString("F"); }

How to delete duplicate row from table sql

If we want to delete the duplicate row from a table we can perform it by sq l. Consider the following SQ L query delete from PATIENT_INFO where MrNo in (select MrNo from PATIENT_INFO group by MrNo having (count(PatientId))>1) and PatientId not in (select min(PatientId) from PATIENT_INFO group by MrNo having (count(PatientId))>1) Here  PATIENT_INFO     is Table Name. and  PatientId  is the primary key of the table. and we want to delete the duplicate  MrNo  .

WPF Main and Child Window Management

In our WPF application we call any child window in our event , example as button click event or other click event. When we can a child window from our main window normally it load our main window.  But if we click on that event again it will load again in main window.  It’s really a big problem for our WPF application. Now we will manage our child window in this scenario that if the child window load once it will not load newly again on it’s event. If we minimize it then it will appear in main window bottom as Task bar. If we click on it’s event it will load from minimize. And only the main window will load on our computer Taskbar . Their will no child window loaded on Taskbar. I have create a method name showWindow. Let see how the method working: This foreach loop find our all current UI from namespace using split if it find out the desire window it just load it on main window.   foreach (Window objWindow in Application.Current.Windows) { ...

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 {...