Microsoft MVP성태의 닷넷 이야기
전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [링크 복사], [링크+제목 복사]
조회: 7075
글쓴 사람
민성 (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)
5644ㅇㅇ4/6/20224272c# 프로그램을 이용하여 리눅스상에 파일 생성이 가능한가요? [1]
5643유필재4/5/20224146TCP클라이언트 연결 및 통신관련하여 문의드려요 [1]
5642차가워4/4/20224407UdpClient 패킷 수신 문의 [4]
5641장성욱4/4/20224801코어 할당 및 cpu 부하테스트 질문 [7]
5640icoo...4/4/20224326웹가든에서 메모리 동적 업데이트 방법 [1]
5639차가워4/4/20224244c++ 서버 c# 클라이언트 호환 문의 [1]
5638초급4/3/20224550c# sql server 연동 [1]
5637따봉이4/1/20224818Winform Form Load 후 자동 캡쳐관련 [1]파일 다운로드1
5636김철순3/31/20224782WPF에서 Richtext의 View 문의 [5]
5635guest3/30/20224779안정적인 pinning이 가능하네요. [3]파일 다운로드1
5633꿀주세요3/30/20224403선생님 마우스 클릭이벤트 질문이 있습니다. [4]
5632김현수3/30/20224773Remote Desktop으로 접속시 WPF UI 가 다시 그려지는 이벤트를 막을 수 없을까요? [3]
5631김기헌3/24/20224384WPF 컨트롤의 그래픽 처리관련 질문드립니다 [2]파일 다운로드1
5630장성욱3/24/20224195로깅관련 질문입니다. [2]
5629감사합니...3/23/20224441함수에서 예외가 발생하면 try ~ catch처리기를 찾을 때 까지 상위 함수로 계속 올라가나요? [2]
5628홍길동3/23/20225098질문드립니다. [2]파일 다운로드1
5626연준혁3/21/20224342안녕하세요. [3]
5625jaew...3/18/20225276c# 8.0 도서를 구입한 사람입니다. [1]
5624초보자3/17/20224234람다 캡처 관련 문의 [2]
5623한예지 donator3/15/20224641인터프리터 원리가 궁금합니다. [4]
5622김민아3/8/20224550const와 readonly의 명확한 차이가 이게 맞나요? [2]
5621장성욱3/8/20224328c# 로그 관련 질문 [1]
5620김민아3/7/20224364안녕하세요 비관리 객체를 반환하는 메소드 호출 시 궁금한 점이 있어서 질문드립니다 [2]
5619팡팡이3/3/20225723RSA 문의드립니다. [3]
5618김기헌3/2/20224233안녕하세요 생성자 옆에 this 키워드를 붙여 생성자를 여러 개 호출 시 질문드립니다 [2]
5617Edun2/25/20224361ArgumentOutOrRangeException에러 발생 [2]파일 다운로드1
1  2  3  4  5  6  7  8  9  10  11  [12]  13  14  15  ...