Home>
Label, textbox, and button are 3 rows, 5 rows in a row, and when the button is pressed, Explorer is opened and the selected file name is displayed in textbox.
I would like to do that, but I asked the question this time because I didn't know how to associate the button and textbox as shown in the example below.
I checked with the tag property, binding, etc., but it did not come up with a solution to see if this was not the case.
I would like to do that, but I asked the question this time because I didn't know how to associate the button and textbox as shown in the example below.
I checked with the tag property, binding, etc., but it did not come up with a solution to see if this was not the case.
Example)
When the button on the second line is pressed, the file name is displayed in the textbox on the second line.
When the button on the third line is pressed, the file name is displayed in the textbox on the third line.
I ’m just starting to study and I ’m very sorry for the introductory question, but I ’d appreciate it.
Applicable source code<Window x: Class = "VoiceApp.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: App"
mc: Ignorable = "d"
Title = "MainWindow" Height = "350" Width = "500">
<StackPanel>
<StackPanel Orientation = "Horizontal" HorizontalAlignment = "Center" Height = "30">
<Label Content = "1" Width = "30" Height = "25" Background = "Transparent"></Label>
<TextBox Name = "one" Width = "30" Height = "25" Background = "Transparent"></TextBox>
<Button Content = "Reference" Width = "40" Height = "20" Click = "reference_Click"></Button>
</StackPanel>
<StackPanel Orientation = "Horizontal" HorizontalAlignment = "Center" Height = "30">
<Label Content = "2" Width = "30" Height = "25" Background = "Transparent"></Label>
<TextBox Name = "two" Width = "30" Height = "25" Background = "Transparent"></TextBox>
<Button Content = "Reference" Width = "40" Height = "20" Click = "reference_Click"></Button>
</StackPanel>
<StackPanel Orientation = "Horizontal" HorizontalAlignment = "Center" Height = "30"><Label Content = "3" Width = "30" Height = "25" Background = "Transparent"></Label>
<TextBox Name = "tree" Width = "30" Height = "25" Background = "Transparent"></TextBox>
<Button Content = "Reference" Width = "40" Height = "20" Click = "reference_Click"></Button>
</StackPanel>
<StackPanel Orientation = "Horizontal" HorizontalAlignment = "Center" Height = "30">
<Label Content = "4" Width = "30" Height = "25" Background = "Transparent"></Label>
<TextBox Name = "four" Width = "30" Height = "25" Background = "Transparent"></TextBox>
<Button Content = "Reference" Width = "40" Height = "20" Click = "reference_Click"></Button>
</StackPanel>
<StackPanel Orientation = "Horizontal" HorizontalAlignment = "Center" Height = "30">
<Label Content = "5" Width = "30" Height = "25" Background = "Transparent"></Label>
<TextBox Name = "five" Width = "30" Height = "25" Background = "Transparent"></TextBox>
<Button Content = "Reference" Width = "40" Height = "20" Click = "reference_Click"></Button>
</StackPanel>
</StackPanel>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;using System.Windows.Shapes;
namespace App
{
///<summary>
/// MainWindow.xaml interaction logic
///</summary>
public partial class MainWindow: Window
{
public MainWindow ()
{
InitializeComponent ();
}
private void reference_Click (object sender, RoutedEventArgs e)
{
// Instantiate dialog
var dialog = new OpenFileDialog ();
// Set the file type of the dialog
dialog.Filter = "Voice file | * .wav";
// Display dialog
dialog.ShowDialog ();
// describe the process of storing the file name in the text box
}
}
}
Please describe what you tried for the problem here.
Supplemental information (FW/tool version etc.)Please provide more information here.
-
Answer # 1
Related articles
- c # - i would like to know how to put delimited data into multiple text boxes from a csv row
- c # - is it possible to set multiple values for one variable?
- i want to load multiple images with resourcesload () [unity, c #]
- javascript - when there are multiple submit buttons in one form, i want to divide the processing depending on which button is pr
- control multiple javascript radio buttons (multiple names)
- c # - i want to create an npc that tracks multiple players by switching targets
- c # - i want to get multiple control names (serial numbers) dynamically
- c # - how to specify multiple array elements in if statement
- javascript - i want to operate multiple check boxes on/off with jquery
- c # - in unity, addforce for multiple objects is stopped at the same position, but there are some variations
- php - if you want to submit with multiple buttons
- [c #] i want to judge data from multiple devices by serial communication
- how can i move multiple objects with unity c #?
- ruby - i want to create multiple radio buttons in form_tag with rails
- c # - display multiple selected items with check boxes of xanarinandroid with displayalert
- javascript - activation of buttons linked to multiple pull-down menus
- javascript - select multiple select boxes and change the link destination according to the input contents
- c # - about list boxes and arrays
- c# add the same item to multiple combo boxes
- there are multiple buttons in the laravel form and i want to perform different processing
Related questions
- c # - [wpf] how to play an animation only when the code-behind conditions are met
- c # - how do i change the selectedindex of a combobox in a specified row of a combobox in a wpf datagrid?
- c # - i want to display an image set in a two-dimensional array with wpf
- c # - is it possible to set storyboardtargetproperty in [wpf] code-behind?
- c # - i want to change the day color of the calender control in wpf
- i want to make a command to delete only the selected element in c # wpf listbox
- c # - i want to create an input table with multiple headers
- c # - [wpf] how to wait for the animation to finish playing and start another process
- c # - i want to read an xml file and display it on the datagrid
- c # - i want to get the content of the child element label in the wpf button
This method uses the abandoned tag property and binding.
instead ofThe code is
dialog.ShowDialog ();