WPF Element 찾기
public List<T> FindVisualChildren<T>(DependencyObject parent) where T : DependencyObject
{
List<T> childrens = new List<T>();
this.FindVisualChildrenHelper(parent, childrens);
return childrens;
}
private void FindVisualChildrenHelper<T>(DependencyObject parent, List<T> childrens) where T : DependencyObject
{
int count = VisualTreeHelper.GetChildrenCount(parent);
for (int index = 0; index < count; index++)
{
DependencyObject child = VisualTreeHelper.GetChild(parent, index);
if (child is T typedChild)
{
childrens.Add(typedChild);
}
FindVisualChildrenHelper(child, childrens);
}
}
'개발 > C#' 카테고리의 다른 글
C# [Spread] Farpoint Spread KeyStroke (0) | 2018.08.10 |
---|---|
[C#] Client IP Address 조회 (0) | 2018.06.04 |
[C#] String을 byte[]로 byte[]를 string으로 변환 (0) | 2018.06.04 |
C# [Spread] Farpoint Spread KeyStroke
// Spread에 Mapping 된 Input을 가져온다.
im = this.fpSpread.GetInputMap(InputMapMode.WhenAncestorOfFocused);
// Tab 키를 눌렀을때 다음 행으로 이동한다.
im.Put(new Keystroke(Keys.Tab, Keys.None), SpreadActions.MoveToNextRow);
// Shift + Tab 을 눌렀을때 이전 행으로 이동한다.
im.Put(new Keystroke(Keys.Tab, Keys.Shift), SpreadActions.MoveToPreviousRow);
// 그외 엔터 등등 다양하게 설정 가능하다.
'개발 > C#' 카테고리의 다른 글
WPF Element 찾기 (0) | 2023.07.04 |
---|---|
[C#] Client IP Address 조회 (0) | 2018.06.04 |
[C#] String을 byte[]로 byte[]를 string으로 변환 (0) | 2018.06.04 |
[C#] Client IP Address 조회
'개발 > C#' 카테고리의 다른 글
WPF Element 찾기 (0) | 2023.07.04 |
---|---|
C# [Spread] Farpoint Spread KeyStroke (0) | 2018.08.10 |
[C#] String을 byte[]로 byte[]를 string으로 변환 (0) | 2018.06.04 |
[C#] String을 byte[]로 byte[]를 string으로 변환
// 바이트 배열을 String으로 변환
private string ByteToString(byte[] strByte) { string str = Encoding.Default.GetString(StrByte); return str; }
// String을 바이트 배열로 변환
private byte[] StringToByte(string str) { byte[] StrByte = Encoding.UTF8.GetBytes(str); return StrByte; }
'개발 > C#' 카테고리의 다른 글
WPF Element 찾기 (0) | 2023.07.04 |
---|---|
C# [Spread] Farpoint Spread KeyStroke (0) | 2018.08.10 |
[C#] Client IP Address 조회 (0) | 2018.06.04 |