// Create DataBinding Class (in .cs)
public class Other_League
{
public string League_Year { get; set; }
public string ChampionsLOGO { get; set; }
public string Champions { get; set; }
public string Second_PlaceLOGO { get; set; }
public string Second_Place { get; set; }
public string Third_PlaceLOGO { get; set; }
public string Third_Place { get; set; }
public string Fourth_PlaceLOGO { get; set; }
public string Fourth_Place { get; set; }
public string Remark { get; set; }
}
// xaml DataBinding
<DataGridTextColumn Header="YEAR" Binding="{Binding Path=League_Year}" Width="80" IsReadOnly="True">
- 조회된 DataGrid에서 Remark를 UI에서 직접 수정 가능하고 수정된 데이터가 DB에 저장되는 기능 구현
CellTemplate.mp4
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Remark}" TextWrapping="Wrap"
Background="Transparent"
VerticalAlignment="Center"
FontSize="12"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Text="{Binding Remark}" TextWrapping="Wrap" BorderThickness="0" VerticalContentAlignment="Center" VerticalAlignment="Center" Background="Transparent" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
AllTeam_TreeView.mp4
private void Treeview_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
System.Diagnostics.Trace.WriteLine(" ComeIn MouseDoubleClick Event");
TreeViewItem view = sender as TreeViewItem;
TeamItem item = AllTeam_treeView.SelectedItem as TeamItem;
try
{
if(item != null)
{
int n = item.Team_Item.Count;
if (n == 0)
{
string sTeamName = item.Team_Name.ToString();
DataPassProdCd(sTeamName);
this.Close();
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
public class TeamItem
{
public TeamItem()
{
this.Team_Item = new ObservableCollection<TeamItem>();
}
public string Team_Name { get; set; }
public ObservableCollection<TeamItem> Team_Item { get; set; }
}