티스토리 뷰
WPF
Datagrid CheckBox Template GetCellContent Null Exception or always False Value error
NicSub 2020. 2. 2. 23:55728x90
반응형
# Xaml
<DataGridTemplateColumn Header="사용여부" Width="70" IsReadOnly="True" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="chks" IsChecked="{Binding Usedchk ,UpdateSourceTrigger=PropertyChanged, Mode=twoWay}" Padding="3,0,0,0" Grid.Column="1" Height="30" Width ="70" Grid.Row="8" HorizontalAlignment="Center" HorizontalContentAlignment="Left" VerticalAlignment="Top" BorderBrush="#FF852789" BorderThickness="3" Background="#FFF38A21" >
<CheckBox.Content>
<TextBlock Text="사용"/>
<!--"{Binding Item}"/>-->
</CheckBox.Content>
</CheckBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
#CS
// Error1. CheckBox mycheckbox = dataGrid1.Columns[7].GetCellContent(dataGrid1.Items[Row_num])) as CheckBox;
// Error2. bool? chks = ((CheckBox)dataGrid1.Columns[7].GetCellContent(dataGrid1.Items[Row_num])).IsChecked;).IsChecked;)
// Solved
FrameworkElement item = dataGrid1.Columns[7].GetCellContent(dataGrid1.Items[Row_num]);
DataGridTemplateColumn temp = (dataGrid1.Columns[7] as DataGridTemplateColumn);
CheckBox cb = temp.CellTemplate.FindName("chks", item) as CheckBox; //
if (cb.IsChecked == true)
{
}
반응형
'WPF' 카테고리의 다른 글
Custom class Clr-namespace (0) | 2020.03.17 |
---|---|
WPF 프린트 출력, PDF -> FTP로 전송 (0) | 2020.02.26 |
WPF Rectangle Animate (0) | 2020.01.29 |
DataTable Column Sum Total (0) | 2020.01.22 |
TextBox get LineNumber and Input Text Handle (0) | 2019.10.11 |
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Entry '' has empty native path
- Windows IIS FTP 디렉토리 목록 오류
- WPF Scrollviewer in ScrollViwer
- SkiaSharp
- Label Text LineBreak in Xaml
- WPF Textbox
- ssl_client_socket_impl.cc
- 암호 마스터키
- WPF Excel Export Microsoft.Office.Interop 성능향상(열 기준으로 복사)
- Embeded 한글Font적용
- c# Encrypt / Decrypt
- Xamarin SMS OTP Send
- Xamarin reCAPTCHA
- Xamarin Firebase Phone Auth
- Xamarin.Ios Firebase Phone Auth
- Xamarin Firebase Phone User Add
- 연산자 뒤에 피연산자가 없습니다.
- Xamarin.Ios Firebase Phone SMS OTP Send
- C# LINQ Left join
- Xamarin.Ios Firebase Phone User Add
- WPF Datagrid Cell Value Change
- Microcharts
- Linux SSH Multi Computer Join
- GetCellContent CheckBox Value
- Xamarin.Forms
- 서버 수준의 URN 필터
- ClickOnce 인증서 인증기간 변경
- FileStream Add Byte
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함