Displaying a custom value type in WPF without using a Value Converter
-
23-09-2019 - |
문제
The system I'm working on uses a large number of custom value types internally. I'm working on a prototype UI using WPF. WPF does not know how to display the custom types. I know that I can write a custom ValueConverter to do this, but I really don't want to have to specify the use of a converter every time I bind to a class in my XAML.
Is there an Interface I can implement in the custom value type that will let WPF know how to display it natively?
Or, is there a way I can specify an application-wide value converter that will apply to any instance of our custom type, without having to specify the ValueConveter in every binding expression?
해결책 2
Aha! Figured it out. I needed to write a TypeConverter and apply it to my custom types. This allows WPF to automatically figure out how to handle them without having to specify a template or converter in the XAML.
다른 팁
예, 2010 년에는 특정 사용자가 누가 그룹에 추가 한 사람과 언제 누가 누가 추가 된지 알아낼 수 있습니다.
감사 데이터를 수집해야합니다.
PowerShell을 사용하여 감사 데이터를 쿼리 할 수 있습니다 (예 : 검색 한 정보를 반환합니다.
$site = Get-SPSite "http://yoursite.company.com"
$startDate = Get-Date "1/1/2013 7:00 AM"
$loginName = "domain\user"
$userId = $site.RootWeb.AllUsers | ? { $_.UserLogin -eq $loginName } | % { $_.ID }
function DumpEvents($site, $searchPattern, $startDate, $eventType, $eventName) {
$usersList = $site.RootWeb.SiteUserInfoList
$query = New-Object Microsoft.SharePoint.SPAuditQuery($site)
$query.AddEventRestriction($eventType)
$query.SetRangeStart($startDate)
$result = $site.Audit.GetEntries($query) | ? { $_.EventData -like $searchPattern } | % {
[xml]$eventData = "<eventData>" + $_.EventData + "</eventData>"
$groupId = $eventData.SelectSingleNode("//groupid").InnerText
$groupName = $groupId
try { $groupName = $usersList.GetItemById($groupId).Name } catch { }
$userName = $_.UserId
try { $userName = $usersList.GetItemById($_.UserId)["Name"] } catch { }
Write-Host $eventName "Group" $groupName "on" $_.Occurred "by" $userName
}
}
Write-Host Changes in group membership of $loginName since $startDate
Write-Host ————————————————–
$searchPattern = "*<user>$userId</user>*"
$eventType = [Microsoft.SharePoint.SPAuditEventType]::SecGroupMemberDel
DumpEvents $site $searchPattern $startDate $eventType "Deleted from"
Write-Host ————————————————–
$searchPattern = "*<userId>$userId</userId>*"
$eventType = [Microsoft.SharePoint.SPAuditEventType]::SecGroupMemberAdd
DumpEvents $site $searchPattern $startDate $eventType "Added to"
. 사용 도구 : 1. FBA. Configuration Manager for SharePoint 2013 - 저자 및 크레딧은 Steve Peschka로 간다. 다운로드에는 Readme 파일이 제공됩니다. WSP가 함께 제공되는 WSP를 등록해야하기 때문에 읽으십시오.