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. Windows API
  4. Binding A StaticResource to a XPath expression

Binding A StaticResource to a XPath expression

Scheduled Pinned Locked Moved Windows API
xmlwpfwcfhelpquestion
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have to bind a Rectangle's Fill to a Brush ,both of them being declared in '<'App.Resources'>' It is a easy task using StaticResource for the Fill property So I've something like this: I'm using quotes sign so the code can be viewed '<'Application.Resources'>' '<'DrawingBrush x:Key="id" x:Name="name"/'>' '<'DataTemplate DataType="item"'>' '<'Rectangle Width="30" Height="30" Fill="{StaticResource id}"/'>' '<'/DataTemplate'>' '<'/Application.Resources'>' The hard part is that I want to bind the name of the Brush to the item's BrushID attribute ( as item is a XML element ) ... the name of the brush I want to use is accesible by XPath=@Brush. so the code should look like this '<'Application.Resources'>' '<'DrawingBrush x:Key="id" x:Name="name"/'>' '<'DataTemplate DataType="item"'>' '<'Rectangle Width="30" Height="30" Fill="{StaticResource XPath=@BrushID}"/'>' '<'/DataTemplate'>' '<'/Application.Resources'>' BUT It seems that StaticResource doesn't support XPath. How should I do this ? Can anyone help me? I'm looking forward to your reply. Mihai

    J 1 Reply Last reply
    0
    • L Lost User

      I have to bind a Rectangle's Fill to a Brush ,both of them being declared in '<'App.Resources'>' It is a easy task using StaticResource for the Fill property So I've something like this: I'm using quotes sign so the code can be viewed '<'Application.Resources'>' '<'DrawingBrush x:Key="id" x:Name="name"/'>' '<'DataTemplate DataType="item"'>' '<'Rectangle Width="30" Height="30" Fill="{StaticResource id}"/'>' '<'/DataTemplate'>' '<'/Application.Resources'>' The hard part is that I want to bind the name of the Brush to the item's BrushID attribute ( as item is a XML element ) ... the name of the brush I want to use is accesible by XPath=@Brush. so the code should look like this '<'Application.Resources'>' '<'DrawingBrush x:Key="id" x:Name="name"/'>' '<'DataTemplate DataType="item"'>' '<'Rectangle Width="30" Height="30" Fill="{StaticResource XPath=@BrushID}"/'>' '<'/DataTemplate'>' '<'/Application.Resources'>' BUT It seems that StaticResource doesn't support XPath. How should I do this ? Can anyone help me? I'm looking forward to your reply. Mihai

      J Offline
      J Offline
      Jonathan Darka
      wrote on last edited by
      #2

      Please post on the correct board and you are more likely to get help.


      Jonathan Wilkes Darka[Xanya.net]

      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