private void DataGrid_KnownEndpoints_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (DataGrid_KnownEndpoints.SelectedItem == null) { return; } var selectedEndpoint = DataGrid_KnownEndpoints.SelectedItem as Endpoint; if (selectedEndpoint.Hostname == "Custom") { Textbox_Computer.Focus(); return; } ConditionalRDPConnection(selectedEndpoint); }
private void DataGrid_KnownEndpoints_SelectionChanged(object sender, SelectionChangedEventArgs e) { string hostName = string.Empty; Endpoint endpoint = (DataGrid_KnownEndpoints.SelectedItem as Endpoint); if (endpoint != null) { hostName = endpoint.Hostname.ToString(); if (hostName == "Custom") { Textbox_Computer.IsReadOnly = false; hostName = string.Empty; Textbox_Computer.Focus(); } else { Textbox_Computer.IsReadOnly = true; } } Textbox_Computer.Text = hostName; }