Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Control Property Updates (Triggers) ??? [modified]

Control Property Updates (Triggers) ??? [modified]

Scheduled Pinned Locked Moved WCF and WF
helpdatabasecomdata-structurestutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kb boxer
    wrote on last edited by
    #1

    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

    A Developer's Experience

    Programming is an art. Code is a poem.

    modified on Wednesday, May 19, 2010 8:52 AM

    V 1 Reply Last reply
    0
    • K kb boxer

      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

      A Developer's Experience

      Programming is an art. Code is a poem.

      modified on Wednesday, May 19, 2010 8:52 AM

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      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>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups