Formatting and Style of Listview Using WPF Window Based
The following code sets background and foreground color of a ListViewItem.
The following code sets background and foreground color of a ListViewItem.
<ListViewItem Background="LightCoral" Foreground="Red" Content="Coffie"></ListViewItem>
Example:
<Window x:Class="WpfApplication7.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="370" Width="417">
<Grid Background="Beige">
<ListView Margin="8,47,0,80" Name="ListView1" HorizontalAlignment="Left" Width="127">
<ListViewItem Content="C" Background="LightPink" Foreground="Blue" ></ListViewItem>
<ListViewItem Content="C++" Background="Violet" Foreground="Blue" ></ListViewItem>
<ListViewItem Content="Java" Background="Silver" Foreground="Blue" ></ListViewItem>
<ListViewItem Content=".Net" Background="CadetBlue" Foreground="Blue" ></ListViewItem>
<ListViewItem Content="Oracle"></ListViewItem>
<ListViewItem Content="SilverLight" Background="MediumSpringGreen" Foreground="Blue" ></ListViewItem>
<ListViewItem Content="SharePoint" Background="DarkOrange" Foreground="Blue" ></ListViewItem>
<ListViewItem Content="WPF" Background="Bisque" Foreground="Blue" ></ListViewItem>
<ListViewItem Content="WCF" Background="Gold" Foreground="Blue" ></ListViewItem>
</ListView>
<TextBox Height="23" HorizontalAlignment="Left" Margin="8,14,0,0"
Name="textBox1" VerticalAlignment="Top" Width="127" />
<Button Height="23" Margin="140,14,0,0" Name="button1" VerticalAlignment="Top"
HorizontalAlignment="Left" Width="76" Click="button1_Click">Add Item </Button>
<Button Height="23" Margin="140,47,0,0" Name="button2" VerticalAlignment="Top"
Click="button2_Click" HorizontalAlignment="Left" Width="76">Delete Item</Button>
</Grid>
</Window>
No comments:
Post a Comment