好的,
我正在WPF(xaml)中的Framework 3.5中开发一个程序,我遇到的问题是,当我想从类代码中更改一行的颜色时,当网格已经有我想要显示的数据时,我找不到路。
XAML 代码:
<ListView.View>
<GridView>
<GridViewColumn Header="#" DisplayMemberBinding="{Binding Path=position}" my:clsGridViewSort.PropertyName="position"></GridViewColumn>
<GridViewColumn Header="{x:Static prop:Properties.Resources.NombreArchivo}" DisplayMemberBinding="{Binding Path=filename}" my:clsGridViewSort.PropertyName="filename" />
<GridViewColumn Header="{x:Static prop:Properties.Resources.FechaInicio}" DisplayMemberBinding="{Binding Path=startdate}" my:clsGridViewSort.PropertyName="startdate" />
<GridViewColumn Header="{x:Static prop:Properties.Resources.FechaFin}" DisplayMemberBinding="{Binding Path=enddate}" my:clsGridViewSort.PropertyName="enddate"/>
<GridViewColumn Header="{x:Static prop:Properties.Resources.UltimaCopia}" DisplayMemberBinding="{Binding Path=lastbackup}" my:clsGridViewSort.PropertyName="lastbackup"/>
<GridViewColumn Header="{x:Static prop:Properties.Resources.Estado}" DisplayMemberBinding="{Binding Path=state}" my:clsGridViewSort.PropertyName="state"/>
<GridViewColumn Header="{x:Static prop:Properties.Resources.Periodicidad}" DisplayMemberBinding="{Binding Path=period}" my:clsGridViewSort.PropertyName="period"/>
<GridViewColumn Header="{x:Static prop:Properties.Resources.Ruta}" DisplayMemberBinding="{Binding Path=path}" my:clsGridViewSort.PropertyName="path"/>
<GridViewColumn Header="{x:Static prop:Properties.Resources.EspacioActual}" DisplayMemberBinding="{Binding Path=actualsize}" my:clsGridViewSort.PropertyName="actualsize"/>
</GridView>
</ListView.View>
在此示例中,gridview 行根据状态值更改颜色(3:红色,2:黄色)
后面的代码:
结果:
您还可以执行以下操作:
这将是鼠标悬停的触发器。