[Solved] How to hide a panel? [closed]

i don’t have VS, so it should be something like this <Button x:Name=”ToggleButton” Click=”ToggleButton_Click”></Button> private void ToggleButton_Click(object sender, RoutedEventArgs e) { if (Panel1.Visibility == System.Windows.Visibility.Visible) { Panel2.Visibility = System.Windows.Visibility.Visible; Panel1.Visibility = System.Windows.Visibility.Collapsed; } else { Panel2.Visibility = System.Windows.Visibility.Collapsed; Panel1.Visibility = System.Windows.Visibility.Visible; } } 5 solved How to hide a panel? [closed]

[Solved] Value’s Not Appearing In Datagrid? [closed]

Ahhh, At last I found solution to it. instead of declaring properties private they should be public:- private string ProductName { get; set; } private string ProductPrice { get; set; } private string ProductUnit { get; set; } private string ProductStock { get; set; } Correction:- public string ProductName { get; set; } public string … Read more

[Solved] WPF MVVM pattern

Your question is a bit scattered. But I’ll try address what I think are your issues. You say in the code behind you have: this.DataContext = new CategoryViewModel(); But nothing else. First thing to do with checking why your button isn’t working would be to see what action it is performing. Your XAML states it’s … Read more

[Solved] Cannot convert ‘string’ to ‘System.DateTime’ C# WPF

If MyClass expects a DateTime, you should use the value from the DatePicker‘s SelectedDate property. It returns a Nullable<DateTime> that can be converted to a DateTime using the GetValueOrDefault() method: newObject = new Classes.MyClass(datePicker.SelectedDate.GetValueOrDefault()); If there is no date selected, GetValueOrDefault() will return DateTime.MinValue. The DatePicker doesn’t store the date in any particular format. That’s … Read more

[Solved] WPF Calling thread cannot access with eventargs

The FinalFrame_NewFrame event is raised on a worker thread by your “video device”…thus as you have figured out you need to use Invoke to get access to your pboLive element on the UI thread…but you need to pass across the “bitmap”. I believe you just need this: this.Dispatcher.Invoke( new Action<Bitmap>( (bitmap) => { pboLive.Source = … Read more

[Solved] Path separators are missing

The issue is that your FileName has single slashes in it. JS will interpret those slashes as escape characters. The simplest solution is to replace your single slashes with double slashes: _mainWindow.Browser.ExecuteScriptAsync( “document.getElementById(‘location’).value=” + ‘\” + openFileDialog.FileName.Replace(@”\”, @”\\”) + ‘\”); solved Path separators are missing

[Solved] How to handle an exception without closing application? [closed]

How I went about in solving my issue: bool success = false; try { //try to send the message smtpmail.Send(message); success = true;//everything is good } catch (Exception err) { //error with sending the message errorMsg.Text = (“Unable to send mail at this time. Please try again later.”); //log the error errorLog.Log(err); //note errorLog is … Read more

[Solved] How to count rows from SQL DB table in VB.NET WPF application? [closed]

Dim cmd As SqlCommand = New SqlCommand(“SELECT qnumber,” + item + ” FROM tencmpC1″, cc) Dim adp As New SqlDataAdapter(cmd) cmd.Connection.Open() Dim ds As new Data.Dataset Dim dt as new Data.DataTable adp.Fill(ds) dt=ds.Tables(0) Dim count as Integer=dt.Rows.Count 2 solved How to count rows from SQL DB table in VB.NET WPF application? [closed]

[Solved] MouseUp event firing wrong [closed]

I found my own answer to my problem.. By using a Buttons click event and just change the style.. The reason for the Image.MouseUp event was fired was, because it was somehow connected to the Window.MouseUp event.. solved MouseUp event firing wrong [closed]

[Solved] Draw samurai sudoku grid on WPF

Example for demonstration. It is not as difficult as in the picture in the question. But it will not be a problem for you to supplement it. public class SudokuCell { public Thickness Border { get; } public int Value { get; set; } public int Row { get; } public int Column { get; … Read more

[Solved] How to make a Progress/Message Window where each line can be different font, size, color?

Found Alternate row color in Listbox and used Bind foreground of Textblock. Realized I needed to make a class to hold my string and color. Put that class in an ObservableCollection, and bind to the ObservableCollection. My new class: public class DisplayData { public string _string { get; set; } public System.Windows.Media.Brush _color { get; … Read more

[Solved] WPF creating grid from XAML in code-behind

You can do that by making your “existing grid” a separate UserControl. First, you need to add a UserControl via [Add]->[User Control…]->[User Control (WPF)]. Next, put your “existing grid” inside the added UserControl. YourExistingGridControl.xaml <UserControl x:Class=”Your.Namespace.YourExistingGridControl”> <Grid> … YOUR EMPTY GRID WITH ALL THE COLUMNS, ETC. … </Grid> </UserControl> Now, you can create as many … Read more

[Solved] Enable MVVM object only if three other MVVM objects are already enable

you could use this: //Button B private bool _enableButtonB; public bool EnableButtonB { get { return _enableButtonB; } set { _enableButtonB = value; OnPropertyChanged(“EnableButtonB”); EnableButtonA=value; } } private bool _enableButtonC; public bool EnableButtonC { get { return _enableButtonC; } set { _enableButtonC = value; OnPropertyChanged(“EnableButtonC”); EnableButtonA=value; } } //Button D private bool _enableButtonD; public bool … Read more