ListBox Disabled state in Silverlight 4 -


So I'm styling a list box and I've got this part where I want to grid out The listbox is disabled, however, when I see state tabs in Blend, only validation states exist - there is no indication of normal general states which have incompetent states.

I tried to create a vanilla project with a custom style and only one listbox and so on. My question is, how do I go about styling a disabled state for a list box? is? Am I clarifying something ??

Tried the first simple approach: ListBoxItem instead of the edit list box Template. This is the item that appears in the disabled state, not the list box.

mix.> Edit a Copy "additional templates Edit"> "items container generated edit (ItemContainerStyle)"

I have to red as a test For the background color forced state in the disabled (see picture below) background color is usually taken from the original list. (To provide border color effect) XAML is also big for listing here.

An item container in the listbox consists of a grid 3 rectangle and a material container to hold the actual item material.

  • Faillklr
  • Faillklor2
  • Kantentpresenter
  • Foksvisualelement

sample output

The obvious problem ... all white space under the item. Bah! There should be a better way. Try

change instead Suchiboksa template: I want to change the template Suchibokse thought you scrollviewer control within the list view template can binding the background color IsEnabled property of This will require a custom value converter (change the IsEnabled bool for the brush object), but they are very easy to make.

TemplateBinding does not support a converter , but I found that you can :

  & lt; ScrollViewer x: Name = "ScrollViewer" BorderBrush = "transparent" BorderThickness = "0" background = padding = "{TemplateBinding padding}" TabNavigation = "{TemplateBinding TabNavigation" {IsEnabled, RelativeSource = {RelativeSource TemplatedParent}, Converter = {StaticResource Bool2Color } Binding} "}" & gt;  

The result looks like this:

alt text

  The code for the value converter is below the public square BoolToColourConverter: IValueConverter {public object Convert (object value, type TargetType, object parameter, System.Globalization.CultureInfo culture) {if (value Bool?) ColorskRed new SolidColorBrush ((value) value as {bool?.? : Colors.Orange); } Throwing new notified exception (); } Public Object Convertback (type object type, type target type, object parameter, system globalization. Culture info culture) {new non imulated expansion (); }}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -