Control Property Updates (Triggers) ??? [modified]
-
Hi I have three buttons (in a stack panel); dont mind the names of the button.
<Button Name="retryBtn" Content="Retry" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5" />
<Button Name="cancelBtn" Content="Cancel" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5"/>
<Button Name="ignoreBtn" Content="Ignore" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5" />1. Now I need to trigger property changes as follows when the ignore button is pressed.
<Button Name="ignoreBtn" Content="Ignore" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Content" Value="Booooooo!!!!" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>But only the Foreground property change happen and other property changes do not happen. Why? 2. In case 1, the property of the same button are being updated. How to update the property of another button (or Control) when the IsPressed of ignoreBtn changes to true? Using TargetName attribute on the Setter node gives compilation error. Any help appreciated. Regards Vivek Ragunathan
Programming is an art. Code is a poem.
modified on Wednesday, May 19, 2010 8:52 AM
-
Hi I have three buttons (in a stack panel); dont mind the names of the button.
<Button Name="retryBtn" Content="Retry" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5" />
<Button Name="cancelBtn" Content="Cancel" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5"/>
<Button Name="ignoreBtn" Content="Ignore" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5" />1. Now I need to trigger property changes as follows when the ignore button is pressed.
<Button Name="ignoreBtn" Content="Ignore" MinWidth="100" MinHeight="50" Margin="5, 5, 5, 5">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Content" Value="Booooooo!!!!" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>But only the Foreground property change happen and other property changes do not happen. Why? 2. In case 1, the property of the same button are being updated. How to update the property of another button (or Control) when the IsPressed of ignoreBtn changes to true? Using TargetName attribute on the Setter node gives compilation error. Any help appreciated. Regards Vivek Ragunathan
Programming is an art. Code is a poem.
modified on Wednesday, May 19, 2010 8:52 AM
Write the Triggers in ControlTemplate. That would work.
Castle Rider
What if I freeze??? Don't forget to breath...
My: Website | Yahoo Group | Blog Spot
/xml>