Questions tagged as 'wpf'

3
answers

WPF - DataGrid - Deletion

How can I get the index of a selected item in my DataGrid in WPF? I know that in WEB Forms I can get it like this: MainGrid.Rows[e.RowIndex].Cells[0].Text     
asked by 14.04.2014 / 20:09
1
answer

Multiple component events in only one method

I have several events of my textbox, the problem is that I have a 30 in my form. I would like to know if there is any way for me to improve my code, reduce it by creating only one method to handle all of those events. Three TextBox sample eve...
asked by 22.05.2015 / 13:18
2
answers

Order of controls cause "System.NullReferenceException"

I'm doing some initial testing with WPF and this question popped up. No error: <DockPanel Margin="5"> <TextBox x:Name="myTextBox" DockPanel.Dock="Right" Width="50" /> <Slider x:Name="mySlider" Width="300" SmallChange=...
asked by 27.02.2016 / 12:37
2
answers

Difference between BackgroundWorker and Task.Run

Generally when I had to do some operation in background , mainly involving progress bar update or labels I used BackgroundWorker , with its events WorkerReportsProgress and DoWork . Recently I came across the source of a...
asked by 31.10.2016 / 17:48
2
answers

Know if the application was terminated by the task manager

Is my application aware that it is being terminated by the task manager? If the user is to terminate my application through the task manager, does my application detect this completion and perform some tasks before it is finished? Does any...
asked by 08.07.2015 / 18:30
2
answers

Get property values from a class

I have the following codes: private PropertyInfo[] ObterPropriedades(Type classe) { PropertyInfo[] properties = classe.GetProperties(); return properties; } private string[] ObterValoresPropriedades(Type classe) { List<string>...
asked by 22.12.2014 / 18:01
1
answer

Entity Framework 6 tries to insert FK

I have a small application in C #, WPF and EF6. I'm using Code First , but I'm having a hard time creating a relationship. Look at my code, of the classes I want to relate: I am editing for the final version, if anyone has the same doubt....
asked by 23.07.2015 / 03:44
2
answers

Terminate a process in C # with WPF

I have a solution that has two projects. one main project and one that serves as an Updater. To perform the upgrade, within the main project, I call a console application as follows. private void Window_Loaded(object sender, RoutedEventArgs...
asked by 08.04.2014 / 14:27
1
answer

How to make a placeholder in a TextBox?

How can I simulate a placeholder using WPF? Something similar to the input of the HTML where you click on the field it adds the text and when you change it returns the text? Remembering it's in WPF, because in Windows forms I know onl...
asked by 28.03.2016 / 13:07
1
answer

Partial for separating events and methods

I have seen in a system a separation of the methods in a partial and the events in another in UserControl and Window as the example below: "Pessoa.xaml.cs" public partial class Pessoa: UserControl { //Construtor //...
asked by 20.04.2016 / 15:58