Posts

Showing posts with the label wpf

How to resolve this System.IO.FileNotFoundException

How to resolve this System.IO.FileNotFoundException Event Viewer Application: The.Application.Name.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen( System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl( System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl( System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.PushFrame( System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.Run() at Sy...

Nested XAML Treeview Structure with mixed object types

Nested XAML Treeview Structure with mixed object types So I've been working on a complex treeview structure using WPF binding. None of the scenarios I've found online have been able to solve the issue, but they have come close. So I have three objects that look something this: public class A { public string Name {get; set;} public List<A> ListOfA {get; set;} public List<B> ListOfB {get; set;} } public class B { public string Name {get; set;} public List<C> ListOfC {get; set;} public List<D> ListOfD {get; set;} } public class C { public string Name {get; set;} public List<D> {get; set;} } public class D { public string Name{get; set;} } It should be noted that the ListOfA, ListOfB, ListOfC, and ListOfD can all be empty. I know this seems convoluted, but it makes perfect sense for my application as to why I'd be doing it this way. Below is an example of what the treeview could look like A - Name | - A - Nam...

Checking for duplicate keys using WPF and C#

Image
Checking for duplicate keys using WPF and C# I'm creating an application that will look AppSettings, pull those keys and their values up into a DataTable, use the DataTable to edit or add keys, check for duplicate keys once edited, and save them back to into AppSettings . I currently have three buttons. One is ProgrammedBy which pulls up a separate data table, a View App Settings within App.config and display it on a data table, and finally an Update Settings button that checks for duplicate keys after the information is entered on the DataTable then save the keys and their values back to AppSettings: AppSettings ProgrammedBy Here is a list of the keys and values within in the App.config file. Note I have given a key a duplicate name: I'm using a nested for loop on the part where it checks for duplicate keys. The System.Collection library only checks the last duplicate key. It totally ignores the first one. When I drill down or hover my mouse over the items variable, Rows/Resu...

WPF custom UserControl - Property Binding

Image
WPF custom UserControl - Property Binding I try to develop a UserControl look like a TextBox white two different changes. UserControl TextBox First of all the new TextBox has to display a "PlaceholderText" if the TextBox text value is empty. My solution for this implementation includes a second TextBox white the "PlaceholderText" as simply Text Attribute. At last I changed the visibility an the focus to the other TextBox . TextBox TextBox TextBox TextBox An when the Textbox ValidationResult Object return false they display a TextBlock white an "ErrorMessage" TextBlock They tow implementations are already working and existent. For my new TextBox I copied all the TextBox specific properties into my new control and passed them to the original TextBox . TextBox TextBox TextBox Now I tried to bind the Text property from my new control to a DependencyPropery Object (in the ViewModel). Text My implementation looks this: Custom TextBox Text property publi...

WPF operation after filling camps

WPF operation after filling camps I'm quite new to c#, especially for application with an interface. I looked for example or guide on WPF but they are too simple. Here is what I would to do: WPF 1) a button to browse on directory and select files; 2) a Listbox and a textBox will be filled using info by the filenames selected previously; Listbox textBox 3) rename those files by web info only when Listbox and textbox are filled. Listbox textbox Point 1) and 2) are done: I wrote the necessary code inside click button event. I was thinking to write code for point 3) inside MainWindow but those lines of code are carried out before I can select files, then there isn't any data yet. MainWindow The easy solution could be to insert the rest of the code inside the click button event too, but I think it's horrible. At the moment I can't understand what to write in the MAIN on a WPF app. The code is: WPF public partial class MainWindow : Window { public MainWindow() ...

VS 2017 : The security debugging option is set but it requires the Visual Studio hosting process which is unavailable

Image
VS 2017 : The security debugging option is set but it requires the Visual Studio hosting process which is unavailable My solution (which contains a dozen projects) works perfectly in Visual Studio 2013. In Visual Studio 2017, I can open the solution and compile it. But if I start the debug, I systematically get this error message: The security debugging option is set but it requires the Visual Studio hosting process which is unavailable in this debugging configuration.The security debugging option will be disabled. This option may be re-enabled in the Security property page. The debugging session will continue without security debugging And then, nothing happens. Nothing starts. For information, this is a solution with multiple startup projects (including a WPF project). Edit : By disabling the option "Enable ClickOnce security settings" under Project -> Properties -> Security tab, it works. Did you check the "Ena...

Running application from setup project not returning UI culture

Running application from setup project not returning UI culture I created a localized wpf apllication. To install the application in the system I used msi installer provided by visual studio. Upon completion of the installation i run the application by running the commit custom action command. In the application I have written the below code to get the current UI Culture commit custom action CultureInfo ci = CultureInfo.CurrentUICulture; string name = ci.Name; My systems current language is in Spanish , but on installing the application via the installer it is returning to en-US culture but should remain Spanish . Once i close the application and run it again using the desktop icon it returns to the correct culture. en-US Can anyone help why it is returning en-US on running application using MSI. Whether you see the installer running in Spanish or English ? – dhilmathy Jun 29 at 10:31 ...

Wpf MVVM and editing DatagridCell

Wpf MVVM and editing DatagridCell In an MVVM project the row of a Datagrid is bound is bound to an object OA and a column of the datagrid is bound to property PB= Code.Value of this object. Code.Value Binding="{Binding Code.Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Binding="{Binding Code.Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" After changing the property PB we do OnPropertyChanged("Code"); OnPropertyChanged("Code"); This seems to work all right, except that when I have edited the value PB in the cell of the datagrid and then click on another control outside the datagrid or on another row of the datagrid or also when I use the enter key, then the setter of property PB is triggered with a blank value "" . This is triggered via "external code". "" I noticed that when I ed...