C#
public DataTable dT { get; } = new DataTable();
XAML
<Window x:Class="WpfApp.MainWindow"
x:Name="MyWindow"
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"
mc:Ignorable="d"
Title="Demo" Height="500" Width="500">
になってるとき、XAMLの
<DataGrid ItemsSource="{Binding dT, ElementName=MyWindow}/>
をコードビハインドで書くにはどうすればいいんですか?
this.DataGrid.ItemsSource = dT;
だとElementNameが指定できませんよね?
WPF(.NET, WinUI) GUIプログラミング Part26
■ このスレッドは過去ログ倉庫に格納されています
840デフォルトの名無しさん
2021/09/11(土) 03:32:20.18ID:8euuf7tr■ このスレッドは過去ログ倉庫に格納されています