Microsoft MVP성태의 닷넷 이야기
전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [링크 복사], [링크+제목 복사],
조회: 7319
글쓴 사람
민성 (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)
1238(non...3/13/201412019(글쓴이의 요청으로 삭제합니다.) [2]
1237(non...3/11/201412128(글쓴이의 요청으로 삭제합니다.) [2]
1236(non...3/11/201413009(글쓴이의 요청으로 삭제합니다.) [2]
1235(non...3/10/201412154(글쓴이의 요청으로 삭제합니다.) [2]
1234(non...3/10/201414189(글쓴이의 요청으로 삭제합니다.) [3]
1233(non...3/9/201412303(글쓴이의 요청으로 삭제합니다.) [4]
1232(non...3/8/201411378(글쓴이의 요청으로 삭제합니다.) [2]
1231(non...3/7/201412693(글쓴이의 요청으로 삭제합니다.) [9]
1230POCO3/7/201413064쓰레드 안에서 DependencyProperty get, set시 또 다른 스레드 오류.. [1]
1229(non...3/6/201412764(글쓴이의 요청으로 삭제합니다.) [11]
1228POCO3/6/201411286안녕하세요. 질문이 있습니다. [1]
1226김형진3/4/201419925안녕하세요 windows azure에 관해 질문했던 사람입니다. [2]
1224(non...3/3/201416063(글쓴이의 요청으로 삭제합니다.) [11]
1223sadf...3/3/201411581아래 질문에 답변 감사드립니다. 한가지 더 궁금한점이 있어 질문드립니다. [1]
1222(non...3/2/201412430(글쓴이의 요청으로 삭제합니다.) [4]
1221(non...3/1/201412473(글쓴이의 요청으로 삭제합니다.) [2]
1220Until2/28/201411006질문드립니다. [1]
1219이성환2/28/201410684string.Join()과 Enumerable.Aggregate()의 차이가 궁금합니다. [2]파일 다운로드1
1218김형진2/25/201412146안녕하세요. window azure에 대해서 질문이 있어서 문의 드립니다 [4]
1217(non...2/23/201412587(글쓴이의 요청으로 삭제합니다.) [1]
1215아리수2/20/201416127C# 공부하면서 WPF에 대한 질문. [2]
1214조광훈2/20/201414378IIS8 응용프로그램 풀 관련 질문 드립니다. [2]파일 다운로드1
1213김태훈2/17/201411269가상화 프로그램 질문입니다. [1]파일 다운로드1
1212조광훈2/13/201410419ISAPI 필터에서 커스텀 헤더 정보 추가 [1]파일 다운로드1
1211조광훈2/12/201413855isapi 필터 로드 오류 [2]
1208박지호2/9/201417237[오타] 시작하세요 C# 프로그래밍 p.267 ~ 350 [1]
... 46  47  48  49  50  51  52  53  54  55  [56]  57  58  59  60  ...