Microsoft MVP성태의 닷넷 이야기
전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [링크 복사], [링크+제목 복사],
조회: 7314
글쓴 사람
민성 (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)
1279(non...6/23/201411673(글쓴이의 요청으로 삭제합니다.) [17]
1278이상식6/19/201412889.net DLL 내 자바스크립트를 수정 또는 재정의 할 수 있을까요? [3]
1277김솔지6/18/201410579silverlight에서 datagrid, listbox질문이여 [2]
1276정우석6/16/201410099쿠키 [1]
1274김솔지6/10/201414580배포 페이지 url을 얻고 싶습니다. [8]
1272이훈모6/7/201410143정말 어려운 상황에 직면했습니다. [1]
1270Jong...6/2/201419606C#과 C++을 이용한 Image 처리. [13]
1269김아영5/29/201410270InitializeComponent 함수 호출 지연 현상 [5]
1268솔솔5/27/20149931smart client [1]
1266김솔지5/22/201411984clickonce 수정에 대해 알고싶습니다. [2]
1265이은아5/22/201415610DataGridView 헤더를 두줄이상으로 하고싶습니다. [1]파일 다운로드1
1264김인호5/18/201413207소스코드 및 예제그림 zip 파일 [1]
1263이영종5/15/201411637159페이지 오타인것 같습니다 [5]
1262(non...5/4/201412488(글쓴이의 요청으로 삭제합니다.) [10]
1261이근주5/4/201410793다시 한번 질문드릴께요. [2]
1259이근주5/1/20149836도서 오류인 것 같네요.. [1]
1258최세정4/28/201412249안녕하세요~php module 오류로 고민하다가 여기까지 왔네요..ㅜㅜ [2]
1252popo4/21/201411514바인딩 질문입니다. [2]
1251(non...4/20/201415637(글쓴이의 요청으로 삭제합니다.) [11]
1249홍용규4/17/201415639app.config 파일 관련 질문 있습니다. [2]
1246(non...3/30/201411961(글쓴이의 요청으로 삭제합니다.) [1]
1245POPO3/26/201411370Http 프로토콜 관련 질문 입니다. [1]
1244(non...3/26/201411475(글쓴이의 요청으로 삭제합니다.) [1]
1241(non...3/22/201415253(글쓴이의 요청으로 삭제합니다.) [4]
1240이석주3/21/201418156인터넷 익스플로러가 hang이 걸리는 현상 문의 [1]파일 다운로드1
1238(non...3/13/201412019(글쓴이의 요청으로 삭제합니다.) [2]
... 46  47  48  49  50  51  52  53  54  [55]  56  57  58  59  60  ...