Binding A StaticResource to a XPath expression
-
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
-
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
Please post on the correct board and you are more likely to get help.
Jonathan Wilkes Darka[Xanya.net]