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

... 16  17  18  19  20  21  22  23  24  25  26  [27]  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
5214Jang...9/4/20198102[DB 테이블의 데이터 변경에 대한 알림 처리] SQL-Server말고 MySQL은 불가능하겠죠? [1]
5213진우8/31/20197373c# 람다 변수 캡쳐 문의 [2]
5212심성보8/29/20199039Clipboard내 여러개의 이미지를 PictureBox로 불러오는 문제 [2]
5211최휘철8/24/20198222CLR20r3 관련된 윈도우 오류입니다. ㅠㅠ 도와주세요. / 아래글 관련하여 관련 파일 올려 드려요^^ [1]파일 다운로드1
5210최휘철8/23/201912115CLR20r3 관련된 윈도우 오류입니다. ㅠㅠ 도와주세요. [5]
5209세퉁8/21/20197755폰트 파일 속성 값을 가져오는 방법 질문 드립니다. [2]파일 다운로드1
5208홍길동8/19/20198586DebugDiag에서 .Net의 Stack Trace를 Windbg에서는 어떻게 볼 수 있나요? [3]
5207민성8/16/20196929네 소스 전체를 올리도록 하겠습니다. [2]파일 다운로드1
5206민성8/14/20197065전 재현 가능하다고 봤는데 다시올리도록 하겠습니다. [1]
5205miny...8/14/20197925안녕하세요 .WPF ListBox시 체크박스가 있는데 체크박스에서 체크가 되었는지 알수 있는 방법이 있을까요? [1]
5204영민8/8/201910699안녕하세요 디버깅시 콘솔창을 띠어서 볼수가 없나요? [7]
5202민성8/6/20197444WPF에서 <Application.Resources에 xaml에 있는 icon 값을 저장하고 xaml에 불러다 사용하고 싶은데요 [1]
5201김대훈8/3/20197071상속시 생성자에 대해 질문드립니다 [3]
5200농상7/30/20199756foreach로 데이터 변경 [2]
5190오리다람7/20/20197156질문드립니다. [3]
5189진우7/19/20197670C# 스레드풀 코어별 실행 문의 [2]
5188황태관7/19/20196897비주얼베이직 2019 실행 할때 마다.. [3]
5187플하7/19/20199722UWP 관련 궁금한 사항에 대해서 [1]
5186김대훈7/14/20198314박싱과 언박싱에 대해 [2]
5185농상7/13/20197177Nullable에 대해서 [1]
5184김대훈7/4/20197067저자님의 책을 다 본후에는 [2]
51837/2/20197770.NET Compact Freamwork 컨트롤러 더블버퍼링 [1]
5182wpf ...7/2/20197956wpf 질문 드립니다. [1]파일 다운로드1
51817/1/20198376DataGridview Doublebuffer 에 대해서 질문드립니다. [2]
5180김대훈6/25/20198418배열과 반복문에서 질문드립니다 [2]
5177농상6/13/20199567멀티스레드 건의 [2]
... 16  17  18  19  20  21  22  23  24  25  26  [27]  28  29  30  ...