Modify A XAML Resource File.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi: I am getting more and more confused so I need help to insert a Geometry Drawing into a xaml file.
  1. Read the xaml resource file.
  2. Locate the DrawingGroup.Children. There are 3 of these in the file I am modifiing.
  3. Insert a Geometry Drawing into the 3 DrawingGroup.Children.
  4. Save and close the file.
It seems simple but I am getting lost between using xml readers or xamlxmlreaders and writers and HELP??
The point of all this is to insert paths the user draws that i have in code into the the xaml resource file.
Here is the resource original file:<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml
<DrawingBrush x:Key="HorizontalPipeOff" Stretch="Uniform
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<!-- Insert Geometry Drawing -->
<GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 50.035,24.9931L 0.0350494,24.9931
<GeometryDrawing.Pen>
<Pen Thickness="3" LineJoin="Round" Brush="#FF000000"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<DrawingBrush x:Key="HorizontalPipeOn" Stretch="Uniform
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<!-- Insert Geometry Drawing -->
<GeometryDrawing Brush="#FF0096FF" Geometry="F1 M 49.9581,25.0765L -0.0418854,25.0765
<GeometryDrawing.Pen>
<Pen Thickness="3" LineJoin="Round" Brush="#FF0096FF"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<DrawingBrush x:Key="HorizontalPipeAlarm" Stretch="Uniform
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<!-- Insert Geometry Drawing -->
<GeometryDrawing Brush="#FFFF0000" Geometry="F1 M 50.0419,25.0765L 0.0418828,25.0765
<GeometryDrawing.Pen>
<Pen Thickness="3" LineJoin="Round" Brush="#FFFF0000"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</ResourceDictionary>
Here is the xaml I am trying to insert:<GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 25.0417,0.0766792L 25.0417,50.0767
<GeometryDrawing.Pen>
<Pen Thickness="3" LineJoin="Round" Brush="#FF000000"/>
</GeometryDrawing.Pen>
</GeometryDrawing>

Mike Gallinger C.Tech. Cutting Edge Computing Software Developer
Mike Gallinger C.Tech. Cutting Edge Computing Software Developer

View the full article
 
Back
Top