Microsoft MVP성태의 닷넷 이야기
전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [링크 복사], [링크+제목 복사]
조회: 7103
글쓴 사람
민성 (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분
조각 코드를 올리지 마시고, "재현 가능한 최소한의, 문제의 핵심만을 담은 예제 프로젝트"를 첨부해 주세요.
정성태

1  2  3  4  5  6  7  8  9  10  11  12  13  [14]  15  ...
NoWriterDateCnt.TitleFile(s)
5591유지킴12/24/20215110outofmemory in 32bit [2]파일 다운로드1
5590kss12/23/20214563포인터 메모리 에러 [1]
5589초급12/22/20214761c# -> 라즈베리파이(db 접속)시 에러 발생 [7]
5588김지신12/21/20214712안녕하세요 String 변수 참조 주소 질문입니다. [2]
5587이완호12/17/20215814C# SharpDX 화면 캡쳐 관련해서 질문 드립니다. [1]
5586조미김12/16/20214987윈폼에서 메인 스레드와 UI 스레드의 차이점 질문드립니다 [4]
5585김준희12/16/20215750C# 윈폼 TCP/IP 데이터 연속으로 보낼때 [1]
5583난인간이다12/10/20214781.net 6 dynamic pgo 활성화 및 예상되는 문제 [1]
5582김준희12/9/202112020C# TCP/IP 통신시 연결 끊김 에러 [1]
5581김시준12/9/20215331닷넷에서 파일 delete 함수는 왜 비동기가 없는 것인가요? [2]
5580카짜프로...12/7/20216551패턴매칭 -튜퓰비교에 관한 오류사항과 궁금증 [1]파일 다운로드1
5579카짜프로...12/6/2021583011.12 메서드 중복정의에 대한 질문 [1]
5577감사합니...11/30/20214860visual studio 2015 update 3를 다운받을려고 하는데 x64/x86 차이점이 뭘까요? [2]
5576노홍구11/29/20214729C# 으로 USB 스캐너 프린터 리셋하기 입니다. [1]
5575베라11/23/20214804event handler 관련 문의 [2]
5574박원웅11/22/20215111닷넷 프레임워크 산출물의 배포시 해당 환경에 프레임워크 버전이 설치되어 있지 않는 경우를 고려한 배포방법은? [3]
5573mijin11/21/20214937System.NullReferenceException 에 대한 질문 [1]
5572김현진11/21/20215104C# list.Clear() 호출에 대한 문의 드립니다. [4]
5571한예지 donator11/18/20215048무설치 프로그램 원리가 궁금합니다. [2]
5570초보11/16/20215559주식데이터 초당 수신 건수를 구하고 있는데 처리속도가 느려서요 [2]
5569카짜프로...11/14/20216428381페이지 UTC에대한 언급이 그리니치 천문대 시간으로 되어있는게 맞나요? [1]
5568카짜프로...11/14/20216491그림 5.20, 그림 5.22 언급 오류 [1]
5567Edun11/2/20215414쿼리문을 코드로 어떻게 처리할 수 있을까요? [2]
5566민성10/26/20215240Linq에 관해서 [1]
5565pass...10/25/20216493wpf에서 Cefsharp를 AnyCPU로 작업 했는데 실행이 되지 않습니다. [4]
5564초보10/21/20214736오버라이드 관련 질문드립니다 [2]
1  2  3  4  5  6  7  8  9  10  11  12  13  [14]  15  ...