Я просто пытаюсь получить содержимое метки и поместить его в переменную. Вот мой Window.xaml
<Grid>
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
<Label Style="{Binding Source={StaticResource studyTitle}}">Study:</Label>
<Label Style="{Binding Source={StaticResource studyTitle}}" Content="{Binding XPath=@Name}" Name="Study_Name_Ref"></Label>
</StackPanel>
</Grid>
, а вот мой Window.xaml.cs
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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using APPIL_Importer.Methods;
using APPIL_Importer.DicomMethods;
namespace APPIL_Importer
{
/// <summary>
/// Interaction logic for StudyImporter.xaml
/// </summary>
public partial class StudyImporter : Window
{
ConsoleOutputStream outputter;
public StudyImporter()
{
InitializeComponent();
this.SizeToContent = SizeToContent.WidthAndHeight;
outputter = new ConsoleOutputStream(TestBox);
Console.SetOut(outputter);
}
public StudyImporter(object data) : this()
{
this.DataContext = data;
this.SizeToContent = SizeToContent.WidthAndHeight;
}
private void Confirm_Import_On_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show("This will import every series in the Import Directory. Are you sure you want to Import?", "Import Confirmation", MessageBoxButton.OKCancel);
string study_name_container = Study_Name_Ref.Content.ToString();
switch (result)
{
case MessageBoxResult.OK:
Console.WriteLine("Welcome Dave. Would you like to play a game?");
MessageBox.Show(study_name_container);
//ModifyDicom.ModifyCommonDicomTags(path_to_file);
break;
case MessageBoxResult.Cancel:
MessageBox.Show("CANCEL", "Nope!");
break;
}
}
}
}
Я хочу захватить содержимое метки с именем «Study_Name_Ref», но что я получаю является следующим: System. Xml .XmlAttribute
какие-либо предложения?