开发者

Indicate ComboBox Value Is Dirty

I'm looking for a good way to indicate the value of a ComboBox is 开发者_开发技巧dirty. With TextBoxes I set the Background to yellow but that looks a little funny with the ComboBox because of the 3d-ness. Any ideas about how to show the ComboBox value is dirty while keeping the look clean and pretty?


A universal way to flag something as dirty is with an asterisk, however this might be misinterpreted as "required" depending on the context of your combobox.


Red border, error image adorner combined with error explanation tooltip are standards used in WPF. But having said that you can achieve many extravagant effects.


I ended up wrapping the ComboBox in a border and setting the thickness and color when the value is dirty. This way the 3D appearance of the ComboBox is preserved.

<Border Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" >
    <Border.Resources>
        <Style TargetType="{x:Type Border}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RankIsDirty}" Value="True">
                    <Setter Property="BorderBrush" Value="Yellow"/>
                    <Setter Property="BorderThickness" Value="2" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Border.Resources>
    <ComboBox Name="DimensionsComboBox"    
        HorizontalAlignment="Left" Margin="2"
        ItemsSource="{Binding Source={StaticResource ResourceKey=Dimensions}}" 
        SelectedIndex="{Binding Rank}"  
    </ComboBox>
</Border>

There were also good suggestions left on my question at: https://ux.stackexchange.com/questions/11007/how-to-indicate-combobox-value-is-dirty

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜