Microsoft MVP성태의 닷넷 이야기
전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [링크 복사], [링크+제목 복사],
조회: 7311
글쓴 사람
민성 (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)
1306이상현8/7/201410057Entity 프레임웍에서 테이블만 추가로 등록하는 방법
1307이상현8/7/201410365    답변글 [답변]: 자답이네요. [1]
1305popo8/7/201411629wpf UserControl List 바인딩 질문 입니다. [1]
1304민경수8/7/201414207네이버 카페에 구글 스프레드 시트 삽입 [1]
1303김동진8/7/201411412vmware환경에서 Guest IP를 192대역으로 받을 수 있는 방법은 없을까요~? [3]
1302김문경7/31/201410587스마트클라이언트 오라클 연결 [1]
1314이재균8/20/201410615    답변글 [답변]: 스마트클라이언트 오라클 연결
1300아로스7/28/201423467c# 인터넷 임시 파일 삭제 문의 [12]파일 다운로드1
1299서동원7/28/201412076안녕하세요. 혹시 Internet_Zone과 관련된문제인가 해서 질문드립니다. [1]
1298(non...7/25/201417470(글쓴이의 요청으로 삭제합니다.) [15]
1295서동원7/22/201413171안녕하세요. 스마트클라이언트에 대해 질문드립니다. [2]파일 다운로드1
1294(non...7/20/201411557(글쓴이의 요청으로 삭제합니다.) [2]
1293VS20...7/20/201412178VS2013 Ultimate에 Windows Phone 프로젝트 템플릿 추가 방법 문의 [1]파일 다운로드2
1292(non...7/20/201410899(글쓴이의 요청으로 삭제합니다.) [2]
1291zino7/16/201411504chromium 배포본 만들기~ [1]
1290(non...7/13/201412661(글쓴이의 요청으로 삭제합니다.) [3]
1288박주만7/8/201421830C# 서비스 기반 데이터베이스(mdf) & InstallShield Limited Edition 설치 및 배포 [2]파일 다운로드1
1287김용환7/8/201419856오라클 db 사용관련 문의입니다. [4]파일 다운로드1
1286C#조으다7/8/201410825WebBrowser 공유기 관리 웹 페이지 인증 [3]
1285C#조으다7/5/201411173IE DocumentComplete 이벤트가 발생되지 않습니다. [2]
1284(non...7/4/201411299(글쓴이의 요청으로 삭제합니다.) [3]
1283김영대7/3/201414414안녕하십니까 정성태님 죄송하지만 SmartClient 에 관한 질문이 있습니다. [9]
1282(non...7/2/201411300(글쓴이의 요청으로 삭제합니다.) [2]
1281(non...7/1/201412387(글쓴이의 요청으로 삭제합니다.) [4]
1280동동이6/25/201411605안녕하세요. ocx의 비동기 또는 쓰레드에서 호출 [1]
1279(non...6/23/201411673(글쓴이의 요청으로 삭제합니다.) [17]
... 46  47  48  49  50  51  52  53  [54]  55  56  57  58  59  60  ...