index > Windows Presentation Foundation ("Avalon") > Selector.IsSelected in RC1

Selector.IsSelected in RC1

I have an ItemContainerStyle on a ListView witch has a trigger on Selector.IsSelected, but it seems to have no effect in RC1?

Best regards,
Thomas Andersen

Thomas S. Andersen

Following seem to work fine in RC1, Is this what you are doing?

<Style x:Key="st1" TargetType="{x:Type ListViewItem}">

<Setter Property="FontSize" Value="10"/>

<Style.Triggers>

<Trigger Property="Selector.IsSelected" Value="True">

<Setter Property="FontSize" Value="15"/>

</Trigger>

</Style.Triggers>

</Style>

lee d

Yes, that's what I'm doing (in theory).

But I tested your code on a new test project and your right it works just fine.
But I found it was setting the Background that doesn't work anymore?

<Setter Property="Background" Value="#FFFF0000"/>

"Selector.IsSelected" doesn't set background (in RC1) but "Control.IsMouseOver" works fine:

<Style x:Key="st1" TargetType="{x:Type ListViewItem}">
<
Setter Property="FontSize" Value="10"
/>
<
Style.Triggers
>
<Trigger Property="Control.IsMouseOver" Value="True">
<
Setter Property="FontSize" Value="15"/> <!-- Works
-->
<
Setter Property="Background" Value="#FF00FF00" /> <!-- Works
-->
</
Trigger
>
<
Trigger Property="Selector.IsSelected" Value="True"
>
<
Setter Property="FontSize" Value="15"/> <!-- Works
-->
<
Setter Property="Background" Value="#FFFF0000"/> <!-- Doesn't work
-->
</
Trigger>
</
Style.Triggers>
</
Style>

Best regards,
Thomas Andersen

Thomas S. Andersen
You can define the triggers inside the ControlTemplate:
<
footballism

Thanks for your detailed example.
But for several reasons this approach doesn't fit very well into our application design. So I would prefer if I don't have to change the entire ListViewItem template.

It seems to be a bug as it use to work fine pre-RC1 just changing the "Background" property in the trigger?

Best regards,
Thomas Andersen

Thomas S. Andersen

I agree, I would like to change the template as the last resort. there are many places where changing a simple property is not possible because of the way the controls are templated.

I thought something like this would work, but it is not. this approach was working before, If I remember correctly

<Style x:Key="st1" TargetType="{x:Type ListViewItem}">

<Style.Resources>

<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}">#FFFF0000</SolidColorBrush>

</Style.Resources>

...

</Style>

lee d
Hey, Lee, I think this approach is more superior than yours:
<
footballism
My thought was not to replace the color at a higher level in the tree, which might effect many controls
lee d
reply 8

You can use google to search for other answers

 

More Articles

• How get click event from button embedded in each item of ListView...
• Issue with WWF in VS2005 in Vista 5472
• mouse events misfiring
• Custom EnumConverter not invoked at design-time
• Custom control design: errors in template
• Stylus events from Wacom graphics tablet
• XAML RSS Reader problem
• Binding style to ListBox items
• Window.LayoutTransform -> Why doesn't this work?
• Data Binding: How to bind a group of Radio Buttons to a value/col...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Resize and reposition window smoothly
• FlowDocumentPageViewer aspect ratio lock
• Possible Bug.... WPF throws excpetion wh
• Binding color from slider value
• Hard to do exact positioning.
• Which eventhandler to use to get ItemCol
• WPF in Vista OS applications?
• autocomplete (using a combobox?)
• wobbling thumb on a slider?
• Is there any SplitContainer Control?
• IRC Help Channel!
• Data Binding: Can't set Content property
• Working with events that are coming from
• PasswordBox Databind or TextBox mask
• XBAP's and firewalls

Hot Articles

• XAML - its purpose
• List View Control Template
• Navigation between pages
• Smooth 8, using beziers
• Moving a control on a canvas at Run-Time
• Set Up project is not working properly
• storyboard
• How: Menu with predefined items AND boun
• ppt file can't show on server
• XmlDataProvider - Recommend when using l
• inline an image into XAML
• debug.assert didn't work in debug mode.
• Binding to Combobox.Text when IsSynchron
• Yet Another Binding Question
• Outlook Bar like control in WPF

Recommend Articles

• How can I discover /access a UI control
• DataBinding ListBox.ItemTemplate = (Data
• How To: Attach event handler to element
• HorizontalAlignment on DataTemplate in G
• Unable to animate custom control object'
• problem using custom control library!!!
• VS.NET dockable tab groups in WPF?
• Refresh ImageBox
• Creating graphs using WPF
• Problem with WindowsFormsIntegration
• bitmapeffect bug?
• Syntax for Binding Attached Properties
• Is it possible to drag objects in a WPF
• IsItemsHost triggerable?
• MouseDown (WindowStyle"None" &