小编man*_*ath的帖子

WPF:更改listview项目的背景颜色

如何更改listview中项目的前景(甚至是后台会做).我有一个程序打开excel并检查给定表单中的断开链接.我想向用户显示给定链接的列表,而且这些链接已被破坏.我想将前景改为RED.我将这些值绑定到了observablecollection.该集合只是字符串的集合(WEB​​ LINKS),并且工作正常

我应该像这里做多重绑定吗?

编辑: - 还有一个问题.创建属性并进行所有更改后.WPF表单没有使用值进行更新.即列表框没有填满.着色都没有发生(不确定它是否也在发生.我无法看到它们).

这是我的代码.请原谅我的编码,我是WPF的新手

<Window x:Class="URLValide.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Local="clr-namespace:URL_Validater.URLValide"
Title="URL Validator" Height="269" Width="525" FontSize="13"
ResizeMode="NoResize">

<Window.Resources>
    <ResourceDictionary>
        <Style x:Key="HighLight" TargetType="{x:Type Control}">
            <Setter Property="Background" Value="Honeydew"/>
            <Setter Property="FontWeight" Value="UltraBlack"/>
            <Style.Triggers>
                <Trigger Property="IsFocused" Value="True">
                    <Setter Property="Effect">
                        <Setter.Value>
                            <DropShadowEffect BlurRadius="40" Color="Beige" Direction="50" Opacity="0.5"/>                                
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Background" Value="White"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </ResourceDictionary>
</Window.Resources>

<DockPanel LastChildFill="True">
    <Label DockPanel.Dock="Top" Name="WinHeader"  Height="30" Background="BurlyWood" FontFamily="Calibri" FontSize="20" FontWeight="Bold" FontStretch="Medium" VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="0,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Top">URL Validator</Label>
    <Grid DockPanel.Dock="Bottom" Background="Beige">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto"/> …
Run Code Online (Sandbox Code Playgroud)

data-binding wpf vb.net-2010

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

data-binding ×1

vb.net-2010 ×1

wpf ×1