2009-08-12 21 views
4

Wie mache ich folgende über C# (wie ich Listviews programmatisch bin Erzeugung):Set WPF-Ressourcen in C#

<ListView> 
    <ListView.Resources> 
     <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/> 
     <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> 
    </ListView.Resources> 
... 

Antwort

2

Ich bin immer noch auf WPF zu lernen, aber Sie könnten versuchen, diese:

ListView view = new ListView(); 
    view.Resources.Add(SystemColors.HighlightBrushKey, new SolidColorBrush(Colors.Transparent)); 
    view.Resources.Add(SystemColors.ControlBrushKey, new SolidColorBrush(Colors.Transparent));