The WPF app i have been working on looks great but there was a small visual irritant which i wasn't being able to get rid of. Everytime i clicked on a UI element..especially a ListViewItem, treeViewitem it would have this default selected look i.e a Blue background with a dotted boundary.Also the default selected look varies depending on the Theme of the OS.
This Blue Background when selected is defined in the Control Template of the element under the Triggers section and can be commented out/ modified to change the default look.You can even force WPF to use a specific theme irrespective of the OS its working on .Hopefully i will be putting in another entry on how to overwrite the default theme of the OS if you want your app to look consisten across say Vista and Server 2003.
My problem was the dotted line around the selected item. This would appear in buttons, treeview items, list view items..almost everywhere.
It took me very long and a lot of trial and error to figure out the property responsible for this dotted line.The property is "FocusVisualStyle". You need to set it to {x:Null} to get rid of that evil dotted line.
<ListViewItem Content="ListViewItem" FocusVisualStyle= "{x:Null}" />
So if you are trying to get a smooth look which selecting your items in a Server 2003 environment
FocusVisualStyle="{x:Null}" is the key!!
Next in queue:-Getting rid of the default blue selected look and forcing WPF app to use a specific theme!!
Until next time..
anshulee
消除WPF默认选择样式
1387

被折叠的 条评论
为什么被折叠?



