Skip to main content

Posts

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

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