Dreamine.UI.Wpf
1.0.1
Dreamine.UI.Wpf 사용자 인터페이스 기능과 구성 요소를 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
PropertyPathValueConverter.cs
이 파일의 문서화 페이지로 가기
1
using
System.Globalization;
2
using
System.Reflection;
3
using
System.Windows.Data;
4
5
namespace
Dreamine.UI.Wpf.Converters
;
6
15
public
class
PropertyPathValueConverter
: IMultiValueConverter
16
{
73
public
object
Convert
(
object
[] values, Type targetType,
object
parameter, CultureInfo culture)
74
{
75
if
(values ==
null
|| values.Length < 2 || values[0] ==
null
|| values[1] ==
null
)
return
null
!;
76
var item = values[0];
77
var propName = values[1]?.ToString();
78
if
(
string
.IsNullOrWhiteSpace(propName))
return
null
!;
79
var prop = item.GetType().GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
80
return
prop?.GetValue(item)!;
81
}
82
131
public
object
[]
ConvertBack
(
object
value, Type[] targetTypes,
object
parameter, CultureInfo culture)
132
{
133
return
new
object
[] { Binding.DoNothing, Binding.DoNothing };
134
}
135
}
136
145
public
class
PropertyAccessorConverter
: IMultiValueConverter
146
{
203
public
object
Convert
(
object
[] values, Type targetType,
object
parameter, CultureInfo culture)
204
{
205
if
(values ==
null
|| values.Length < 2 || values[0] ==
null
|| values[1] ==
null
)
return
null
!;
206
var item = values[0];
207
var propName = values[1]?.ToString();
208
if
(
string
.IsNullOrWhiteSpace(propName))
return
null
!;
209
var prop = item.GetType().GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
210
return
prop?.GetValue(item)!;
211
}
212
261
public
object
[]
ConvertBack
(
object
value, Type[] targetTypes,
object
parameter, CultureInfo culture)
262
{
263
if
(parameter is
object
[] p && p.Length >= 2) { }
264
return
new
object
[] { Binding.DoNothing, Binding.DoNothing };
265
}
266
}
Dreamine.UI.Wpf.Converters
Definition
AddOffsetConverter.cs:10
Dreamine.UI.Wpf.Converters.PropertyPathValueConverter
Definition
PropertyPathValueConverter.cs:16
Dreamine.UI.Wpf.Converters.PropertyPathValueConverter.ConvertBack
object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
Definition
PropertyPathValueConverter.cs:131
Dreamine.UI.Wpf.Converters.PropertyPathValueConverter.Convert
object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
Definition
PropertyPathValueConverter.cs:73
Dreamine.UI.Wpf.Converters.PropertyAccessorConverter
Definition
PropertyPathValueConverter.cs:146
Dreamine.UI.Wpf.Converters.PropertyAccessorConverter.ConvertBack
object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
Definition
PropertyPathValueConverter.cs:261
Dreamine.UI.Wpf.Converters.PropertyAccessorConverter.Convert
object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
Definition
PropertyPathValueConverter.cs:203
Converters
PropertyPathValueConverter.cs
다음에 의해 생성됨 :
1.17.0