[Solved] Closing a window in WPF

You only need to input this.Close(); before showing next window. private void Button_Click_1(object sender, RoutedEventArgs e) { Window2 win3 = new Window2(); this.Close(); win3.Show(); } 0 solved Closing a window in WPF

[Solved] if(checkbox.Checked){} issues [duplicate]

Checked is an event (that’s why an exception is being thrown when your code looks for an handler subscription, MSDN reference), IsChecked is a Boolean and it’s probably the property you are looking for (MSDN reference). Your code should look like this: private void button_Click(object sender, RoutedEventArgs e) { if ((bool)checkBox1.IsChecked) Console.Write(“Checked”); } 5 solved … Read more

[Solved] WPF Shaped Button – Visaul Studio/Blend

You need to create a ControlTemplate for the Button. This can be done both in Blend and Visual Studio. I did it in VS2015. Here is your code: But, for the future, try to do some work yourself before posting the question. Include just enough code to allow others to reproduce the problem. For help … Read more

[Solved] Cannot access class from another class c#

Obviously your main window is a YourProgress but you could try to get a reference to the ChooseExercises window using the Application.Current.Windows collection: private void TabThursday_Loaded(object sender, RoutedEventArgs e) { ChooseExercises ce = Application.Current.Windows.OfType<ChooseExercises>().FirstOrDefault(); … } 2 solved Cannot access class from another class c#

[Solved] .NET bug. How to fix?

I solved this problem by using the Dispatcher: private void grid_SizeChanged(object sender, SizeChangedEventArgs e) { //text.Text = grid.Width.ToString(); Dispatcher.BeginInvoke(new Action(() => text.Text = grid.Width.ToString())); } Thank you all for “help” and negative rating. solved .NET bug. How to fix?

[Solved] How to check if the mouse did not move for 2 minutes in WPF?

Add a timer control to your application. Subscribe to mouseover and keydown events – when they fire, reset the timer. When the timer fires (ie mouse hasn’t moved and key’s haven’t been pressed for x amount of time), lock the screen / prompt for login. This could also help: http://www.codeproject.com/Articles/13756/Detecting-Application-Idleness solved How to check if … Read more

[Solved] Unable to Render ContentControl inside Window [closed]

Set the DataContext property of the window: <Window x:Class=”MimicView.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″ xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ xmlns:local=”clr-namespace:MimicView” mc:Ignorable=”d” d:DataContext=”{d:DesignInstance local:MainWindowViewModel}” Title=”MainWindow” Height=”350″ Width=”525″> <Window.Resources> <DataTemplate DataType=”{x:Type local:ViewModel1}”> <local:View1/> </DataTemplate> </Window.Resources> <Window.DataContext> <local:MainWindowViewModel /> </Window.DataContext> <Grid> <ContentControl Content=”{Binding viewModel1}”></ContentControl> </Grid> </Window> This only sets the design time DataContext: d:DataContext=”{d:DesignInstance local:MainWindowViewModel}” You should also set the actual DataContext property: <Window.DataContext> … Read more

[Solved] How to add sqrt in WPF calculator c# [closed]

Math.Sqrt XAML: <Grid> <Button Content=”&#8730;” HorizontalAlignment=”Left” Margin=”145,10,0,0″ VerticalAlignment=”Top” Width=”75″ Click=”OnSquareRootClick”/> <TextBox x:Name=”txtNumber” HorizontalAlignment=”Left” Height=”23″ Margin=”10,10,0,0″ Text=”” VerticalAlignment=”Top” Width=”120″/> <TextBox x:Name=”txtResult” HorizontalAlignment=”Left” Height=”23″ Margin=”240,10,0,0″ Text=”” VerticalAlignment=”Top” Width=”120″/> </Grid> Code Behind: private void OnSquareRootClick(object sender, RoutedEventArgs e) { double number; var isDouble = double.TryParse(this.txtNumber.Text, out number); if (isDouble) { this.txtResult.Text = string.Format( “{0}{1} = {2}”, “\u221A”, this.txtNumber.Text, … Read more

[Solved] Given a list of named doubles, return the name of the variable with the lowest value [closed]

You need a way to associate the inventory level of the ingredients (which you have as your double variables), with the order id of the ingredient (which is the result you want at the end). One solution would be to use an Ingredient class that might look something like this: public class Ingredient { public … Read more

[Solved] Create a listing using etsy api from a desktop application

var baseUrl = “http://openapi.etsy.com/v2/listings”; restClient = new RestClient(baseUrl); oAuth = new OAuthBase(); e1 = new Etsy_portal(consumerKey, consumerSecret); string str = e1.GetConfirmUrl(out AccessToken, out AccessTokenSecret); e1.ObtainTokenCredentials(AccessToken, AccessTokenSecret, verifiedToken, out PAccessToken, out PAccessTokenSecret); sigHasher = new HMACSHA1(new ASCIIEncoding().GetBytes(string.Format(“{0}&{1}”, consumerSecret, PAccessTokenSecret))); string nonce = oAuth.GenerateNonce(); string timeStamp = oAuth.GenerateTimeStamp(); string normalizedUrl; string normalizedRequestParameters; var data = new Dictionary<string, … Read more