Microsoft MVP성태의 닷넷 이야기
전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [링크 복사], [링크+제목 복사],
조회: 14854
글쓴 사람
민성 (minyy1 at hanmail.net)
홈페이지
첨부 파일
 

<Window x:Class="WpfApp18.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:WpfApp18"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <StackPanel>
        <ListBox x:Name="ttt">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                    
                        <Grid.ColumnDefinitions>

                            <ColumnDefinition/>
                            <ColumnDefinition/>
                          
                        </Grid.ColumnDefinitions>

                        <CheckBox Grid.Column="0" Tag="{Binding P_Idx}"> ssss</CheckBox>
                        <Label Content="{Binding P_Name}" Grid.Column="1"></Label>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Button x:Name="ddds" Click="ddds_Click" Content="체크된값 가져오기"/>
    </StackPanel>
</Window>

비하인드
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Navigation;
using System.Windows.Shapes;

namespace WpfApp18
{
    /// <summary>
    /// MainWindow.xaml에 대한 상호 작용 논리
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            SetLoad();
        }

        private void SetLoad()
        {
            List<Cust> li = new List<Cust>();
            li.Add(new Cust() { P_idx = "1111", P_Name = "영민" });
            li.Add(new Cust() { P_idx = "2222", P_Name = "영민2" });
            li.Add(new Cust() { P_idx = "3333", P_Name = "영민3" });
            ttt.ItemsSource = li;
        }

        private void ddds_Click(object sender, RoutedEventArgs e)
        {
            foreach (Cust item in ttt.Items)
            {
                ==>여기서 어떻게 구현해야 checkbox에 체크된 tag값을 읽어올수있을가요?

            }
        }
    }


    public class Cust
    {
        public CheckBox ccc { get; set; }
        public string P_idx { get; set; }
        public string P_Name { get; set; }
    }
}

감사합니다...








[최초 등록일: ]
[최종 수정일: 8/14/2019]


비밀번호

댓글 작성자
 



2019-08-15 12시14분
조각 코드를 올리지 마시고, "재현 가능한 최소한의, 문제의 핵심만을 담은 예제 프로젝트"를 첨부해 주세요.
정성태

... 46  47  48  49  50  51  52  53  54  55  56  [57]  58  59  60  ...
NoWriterDateCnt.TitleFile(s)
1241(non...3/22/201421114(글쓴이의 요청으로 삭제합니다.) [4]
1240이석주3/21/201423774인터넷 익스플로러가 hang이 걸리는 현상 문의 [1]파일 다운로드1
1238(non...3/13/201417697(글쓴이의 요청으로 삭제합니다.) [2]
1237(non...3/11/201417732(글쓴이의 요청으로 삭제합니다.) [2]
1236(non...3/11/201418584(글쓴이의 요청으로 삭제합니다.) [2]
1235(non...3/10/201417667(글쓴이의 요청으로 삭제합니다.) [2]
1234(non...3/10/201420841(글쓴이의 요청으로 삭제합니다.) [3]
1233(non...3/9/201418536(글쓴이의 요청으로 삭제합니다.) [4]
1232(non...3/8/201417431(글쓴이의 요청으로 삭제합니다.) [2]
1231(non...3/7/201418726(글쓴이의 요청으로 삭제합니다.) [9]
1230POCO3/7/201419076쓰레드 안에서 DependencyProperty get, set시 또 다른 스레드 오류.. [1]
1229(non...3/6/201419739(글쓴이의 요청으로 삭제합니다.) [11]
1228POCO3/6/201417782안녕하세요. 질문이 있습니다. [1]
1226김형진3/4/201427928안녕하세요 windows azure에 관해 질문했던 사람입니다. [2]
1224(non...3/3/201423263(글쓴이의 요청으로 삭제합니다.) [11]
1223sadf...3/3/201417771아래 질문에 답변 감사드립니다. 한가지 더 궁금한점이 있어 질문드립니다. [1]
1222(non...3/2/201418217(글쓴이의 요청으로 삭제합니다.) [4]
1221(non...3/1/201418672(글쓴이의 요청으로 삭제합니다.) [2]
1220Until2/28/201416975질문드립니다. [1]
1219이성환2/28/201416401string.Join()과 Enumerable.Aggregate()의 차이가 궁금합니다. [2]파일 다운로드1
1218김형진2/25/201418265안녕하세요. window azure에 대해서 질문이 있어서 문의 드립니다 [4]
1217(non...2/23/201418865(글쓴이의 요청으로 삭제합니다.) [1]
1215아리수2/20/201422284C# 공부하면서 WPF에 대한 질문. [2]
1214조광훈2/20/201420292IIS8 응용프로그램 풀 관련 질문 드립니다. [2]파일 다운로드1
1213김태훈2/17/201417477가상화 프로그램 질문입니다. [1]파일 다운로드1
1212조광훈2/13/201416256ISAPI 필터에서 커스텀 헤더 정보 추가 [1]파일 다운로드1
... 46  47  48  49  50  51  52  53  54  55  56  [57]  58  59  60  ...