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

... 31  32  [33]  34  35  36  37  38  39  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
5044엿장수8/20/20188263graphedit 에 등록되어있는 필터를 가져와서 사용하는방법을 알고싶습니다 [2]
5043hori...8/20/20187893Expression에 대한 책의 예제 관련하여 질문드립니다. [1]
5042황윤하8/20/20189614모드버스 TCP 관련 질문 [3]
5041david8/18/20189260.NET WebAPI 에서 Response 지연되는 이유 [3]
5040농상8/14/20188716정규표현식에 대해서 [3]
5039유영태8/14/201810282비동기 소켓사용후 해당 스레드가 남아있을때 처리 방법 [4]파일 다운로드1
5038이정석8/9/20188440서버파일 로컬파일 비교 [2]
5037jjh8/8/201811816c# 으로 화면캡쳐해서 동영상으로 만드는앱을 만들고싶습니다 [6]
5036볼딱지8/8/20189618C# programming 개발 관련 질문이 있습니다. [1]
5035궁금합니...8/8/201810295C# 버전 고민 어떤 책을 사야하나요? [1]
5034신동열8/8/20188717덤프 파일 분석 관련해서 문의 드려요. [1]
5033최규성8/7/201810805C# WinForm, Oracle 9i 로 프로그래밍시 ODP.NET, 배포 설정 방법 질문입니다. [6]
5032이정석8/6/201812630C# 으로 만들 dll 등록 [7]
5031J.S.8/6/20188273System.Array class의 구조에 대한 질문 [1]
5030농상8/4/20188817람다 식을 이용한 메서드 정의 확대를 공부하고 있습니다. [2]
5029Soul...8/3/20188316C# ActiveX 컨트롤 질문드립니다. [4]
5028도토리8/1/20188867혹시 회사에서 TFS 구축시 SQL-Server 라이선스 정책 아시는분 계신지요? [2]
5027농상7/31/20189662Freachable Queue의 발음을 표기하면 어떨까요? [2]
5026농상7/31/201812160소멸자의 이름에 대해서 [2]
5025김기철7/30/20189608selenium 질문좀 드릴개요 [3]
5024농상7/29/20188890패턴 매칭 when에 대해서 질문있습니다. [2]
5023농상7/28/201811877패턴매칭에 대해서 질문 있습니다. [1]
5022농상7/28/20188852튜플에 대해서 건의가 있습니다. [1]
5021농상7/27/20188352예외필터에 대해서 질문이요 [4]
5020농상7/27/201811243null 조건 연산자 예제에서 잠깐 혼동이 일어났습니다. [1]
5019농상7/26/201813559오버플로우와 언더플로우 [2]
... 31  32  [33]  34  35  36  37  38  39  40  41  42  43  44  45  ...