[Solved] User Control Background Hides Children Controls

The Margin properties on the controls set themselves when dropped on the design surface. This feature may be needed if adjusting items on a Canvas but are mostly an annoyance when dealing with most Xaml control placement. Remove the Margin properties to see the controls in their correct location on the grid. solved User Control … Read more

[Solved] Making smooth effect in WPF manually in C# with DispatcherTimer

The ApplicationHelper.DoEvents() in dt_Tick probably does nothing, since there are no events to process. At least not the ones you’re probably expecting. If I’m not mistaken, your code will just quickly set the Radius to 0, then 1, 2, and so on in quick succession, and finally to 19. All of that will happen every … Read more

[Solved] The name of WPF [closed]

There’s no class by the name of Wpf. If you’re looking for the equivalent of System.Windows.Forms.Form, that would be System.Windows.Window. By the way, WPF is a complex framework in and of itself (not suitable for the unexperienced), I suggest you learn the basics of C# and OOP by practicing with some Console Applications first. 0 … Read more

[Solved] Assist me to define UI in xaml [closed]

The first thing is: It is in 99% of all cases the best and possible to write you UI in XAML. Second you should inform yourself, whats the WPF indicates and how to use the MVVM. If you don’t you should stay by Windows Forms! So now: You ViewModel: using System; using System.Collections.Generic; using System.Collections.ObjectModel; … Read more

[Solved] How to call a non-static method from another class without using instances in c#?

This all depends on the functionality of your Connections class. The easiest answer I can give is that you can make the individual methods static, assuming they don’t require instance specific data. If your individual methods require instance specific data, then you could possibly make the instance a singleton instance (either through have an Instance … Read more

[Solved] Read Key in Wpf [closed]

If you have access to XAML, try the OnKeyDownHandler method. XAML: <StackPanel> <TextBlock Width=”300″ Height=”20″> Type some text into the TextBox and press the Enter key. </TextBlock> <TextBox Width=”300″ Height=”30″ Name=”textBox1″ KeyDown=”OnKeyDownHandler”/> <TextBlock Width=”300″ Height=”100″ Name=”textBlock1″/> </StackPanel> C#: private void OnKeyDownHandler(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { textBlock1.Text = “You Entered: ” … Read more

[Solved] Why does this causes the application to hang [closed]

The biggest problem here is that your constructor does not return until all of the tasks have completed. Until the constructor returns, the window will not be shown, because the window messages related to drawing the window aren’t going to be processed. Note that you don’t really have “deadlock” here per se. Instead, if you … Read more

[Solved] Saving values from arraylist to txt C# [closed]

static void SaveArray() { ArrayList myArray = new ArrayList(); myArray.Add(“First”); myArray.Add(“Second”); myArray.Add(“Third”); myArray.Add(“and more”); StreamWriter sw= File.CreateText(@”C:\file.txt”); foreach (string item in myArray) { sw.WriteLine(item); } sw.Close(); } and you shouldn’t use arraylist not because its 2013 ,but because arraylist boxing each item in the array, where List store the type also. this cost less in … Read more

[Solved] Trouble calling variables [closed]

The sample you provided have some mistakes. addValues method in your code is not accepting any parameters but your code is trying to pass 2 parameters. I have re wrote your code. Please see below code snippet meets your requirement private int addValues(int var1, int var2) { return var1 + var2; } private void plus_Click(object … Read more