Save the user input parameters in perl config file from xaml file - c#

I have a application which was developed using perl and its UI is designed by xaml and c# files in visual studio. So now I had created a confilg file in perl where the source code files uses this config file to read inputs from. For that I want to save the parameters into the perl config file that I had created already from user input xaml file and c# as binding for GUI. I want to know if there is a way to save the paramerts to perl file using xaml and c# file in visual studio.
Here is an example for xaml file and c# binding file from GUI of the tool.
xaml file:
<TabItem Header="Properties" x:Name="tabItem1_Copy" Margin="-2,-2,-2,0">
<Grid Margin="0,0,4.2,2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Height="20" Margin="295,58,0,0" x:Name="tbShiftColumns" Width="40" />
<TextBlock Height="20" x:Name="textBlock7" Text="Shift Columns" Width="75" />
</Grid>
</TabItem>
xaml.cs file:
private void bxxxxxx_Click(object sender, RoutedEventArgs e)
{
tFLog.Clear();
Process prc = new Process();
prc.StartInfo.FileName = "xxxxxxxxxxxxx.bat";
prc.StartInfo.Arguments = "\"" + tbCustPar.Text + "\" \"" + tbShiftColumns.Text + "\"";
prc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;//.Hidden;
prc.StartInfo.UseShellExecute = true;
prc.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection);
prc.Start();
prc.WaitForExit();
prc.Close();
string logFileName = System.IO.Path.GetDirectoryName(System.Reflection) + "\\xxxx.log";
StreamReader sr = new StreamReader(logFileName, System.Text.Encoding.Default, true);
tFLog.Text = sr.ReadToEnd();
}
and in the above 2 example codes once can observe tbshift columns is one of the input parameters in .xaml file and it is binded using c# .xaml.cs file. that is what i mean. Now I want to find a way to save the user input parameters directly into a perl config file. I already created one and will be displayed below for reference.
perl config file:
#variables to be parsed to xyz.pl file
maxDepth = tbNoLevels
shiftt = tbshiftColumns
I hope I had explained my problem as clear as possible. Any suggestion or answers are highly appriciated.
Thank you
I tried to create a app.config file in visual studio and it looked like this :
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
I think here we can add dictionaries like key and value pairs : <add key="Key0" value="0" />
but I want to save the input parameters directly into a perl config file.
And I also tried to create a App.xaml file this has:
<Application x:Class="xxxxxxxxxxxxxx"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="xxxxxxxx.xaml"\>
<Application.Resources\>
</Application.Resources>
</Application>
I have no idea what can be done. Any proper direction of action to solve is issue is highly expected. Or suggest any other alternatives to achieve this. I am beginner I would expect a detailed answer please.

Related

Images are not displayed at run-time in ListBox [duplicate]

All, I have the following start to a small application that checks .resx files for consistency of embedded brackets (so that runtime errors of non-matching "... {0}" strings don't happen). I have the following XAML for the MainWindow.xaml, and my particular problem relates to the image that is to be displayed on the button
<Window x:Class="ResxChecker.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="174.383" Width="495.869">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="350*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="30*"/>
</Grid.RowDefinitions>
<Label Content="Select .resx file:" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" Height="24" Width="Auto" Grid.ColumnSpan="1"/>
<TextBox Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Margin="10,0,0,0" Grid.Row="1" TextWrapping="Wrap" Text="" VerticalAlignment="Top"/>
<Button Grid.Column="2" HorizontalAlignment="Right" Margin="5,0,10,0" Grid.Row="1">
<Image VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="16 " Width="16" Source="pack://siteoforigin:,,,/Resources/UserCost2013Open16.png"/>
</Button>
</Grid>
</Window>
The image has 'Build Action = Resource', 'Copy to output directory = Do not copy' - the image shows in the designer but not at runtime. I have seen the following questions and read the relevant answers, but none resolve the problem:
WPF control images not displayed when consumed by an application
image problem in wpf (image does not show up)
Background Image of Button not showing in WPF
How do I get the button image to appear at runtime?
Change the build action to 'Resource'.
Also your pack url is wrong. Either use:
Source="pack://application:,,,/Resource/UserCost2013Open16.png"
or simply
Source="/Resource/UserCost2013Open16.png"
There are 2 Solutions:
1: Change the settings of the image:
Build Action = Content
Copy to output directory = Copy if newer
Source="pack://siteoforigin:,,,/Resources/UserCost2013Open16.png"
2: When Using application instead of siteoforigin in the source path, you have to possible ways:
a) Image will be in a SubFolder called "Resources" and .exe file will be small
Source="pack://application:,,,/Resources/UserCost2013Open16.png"
Build Action = Content
Copy to output directory = Copy if newer
b) Image will be included in the .exe and no Subfolder with imagefile will exist
Source="pack://application:,,,/Resources/UserCost2013Open16.png"
Build Action = Resource
Copy to output directory = Copy if newer
Assuming that you have set your Build Action to Resource.
Use the URI-PACK-FORMAT:
pack://application:,,,/ResourceFile.xaml or pack://application:,,,/Subfolder/ResourceFile.xaml or
pack://application:,,,/ReferencedAssembly;component/ResourceFile.xaml
Those are the most common examples.
Also, in my case it was still not showing.
Clean & Rebuild NOT just Build fixed it for me (VS 2019)!
In my case I had the images in a separate project named Common and the images were under a folder named Resources in this project. In my other project, I added a reference to Common and set the source of the images like this:
<Image Source="/Common;component/Resources/anImage.png"/>
The images have the Build Action set to Resource and Copy to Output Directory to Do not copy. However, for some strange reason it wasn't working until I deleted every assembly file in my solution and made a Clean Solution and Build Solution. Not sure why, but it all started working at runtime once I rebuilt everything. I still can't figure out why it was working at Design Time though.
Go to your image in the resources folder, right click on the image, go to properties, click on the Build Action property, and change it from None to Resource. That'll work.
You should add any thing inside Solution Explorer of Visual Studio.
Instead of just copying the image to folder in Windows Explorer, press Right Click on any folder in Solution Explorer go to Add > Existing Item... and select the path to your resource to be added.
I defined my image as next:
<Image Source="/Resources/Images/icon.png"/>
The image is displayed in Visual Studio designer but no image is displayed when I launched the app! It made me nuts!
I tried all Build Actions with clean/build, no luck.
In my case the problem is caused by the fact that the control (which uses Image) and the app itself are in different projects. Resources/Images folder is in the Controls project. As result the app attempted to find icon.png in its own Debug folder, but actually it is in Controls' Debug folder.
So two solutions work for me:
1) put Resources/Images in the app's project (not so good when there are several projects which use controls from Controls project, but it works)
2) specify the name of Controls project explicitly inside Image:
<Image Source="/Controls;component/Resources/Images/icon.png"/>
Visual Studio 2022 (but should work in other versions). Add your image to a folder named as you want, in this example I created an Assets named folder. Then set the image's property to Resource in the Build Action. Then select the image in the folder and drag and then drop the into <MenuItem.Icon> and it should path properly..
Note you may need to Rebuild the project, the compiler sometimes doesn't recognize new resources as a need to rebuild.
Make a new folder and put your pictures in the new folder and write this in XAML
<Image Source="/newfolder/icon.png"/>
For me, changing the "build action" to "Resource" and the "copy to output directory" to "Do not copy" has solved my problem.
Source="file:///D:/100x100.jpg"/> works for me.

WPF right-click menu wouldn't use local language after changing Windows 10 regional settings

I've built a very basic WPF, but the context menus which appear when right-clicking on scrollbars or text selections remain in English, even when the local language/regional settings was changed to a different language. Code is attached at the bottom of this post.
At first, I thought maybe I didn't change all the language related settings on a system level, but when I try that in notepad, it works fine (meaning, the right-click menu isn't in English).
So I thought maybe it's some kind of a .net/WPF-specific issue, so I checked with Paint.net and it was fine there as well (though it might be non-WPF C# and C++ mixed?). Also tried to install the latest .net Framework Language Pack, which wouldn't install because it already exists on my PC.
You can see the differences in context menus between my app and Notepad in the following screenshots:
The code for the example app which reproduces this problem is pretty basic.
This is the xaml file:
<Window x:Class="WpfTestScrollLanguage.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTestScrollLanguage"
mc:Ignorable="d"
Loaded="Window_Loaded"
Language="uk-ua"
xml:lang="uk-UA"
Title="MainWindow" Height="100" Width="525">
<Grid Height="300" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible" Language="uk-ua" xml:lang="uk-UA">
<ListView Language="uk-ua" xml:lang="uk-UA">
<Button Content="A" Height="20" Width="20"/>
<Button Content="B" Height="20" Width="20"/>
<Button Content="C" Height="20" Width="20"/>
<Button Content="D" Height="20" Width="20"/>
<TextBlock Height="300" Name="Text"/>
<TextBox Height="50" Width="300" Text="test123" Language="uk-ua" xml:lang="uk-UA"/>
</ListView>
</Grid>
and this is the .xaml.cs file that goes along with it (only the code that isn't auto-generated):
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var test = System.Globalization.CultureInfo.CurrentCulture;
var test2 = System.Globalization.CultureInfo.CurrentUICulture;
var test3 = this.Language;
var test4 = System.Windows.Markup.XmlLanguage.GetLanguage(System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
Text.Text = "a\nb\nc\nd\ne\nf";
}
all of the test variables in runtime have shown "uk-UA" (as I've changed the OS language and region to Ukraine) even without setting those values manually within the xaml file itself. I just added them explicitly to the UI elements defined in the xaml file, to make sure I cover all possible cases.
edit: the app.config file is pretty simple, and doesn't seem related in this scenario:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
Any idea about what I might be missing here? (Running on Windows 10 RS1, but I've observed the same problem also in RS2 and RS3-beta)
edit2: I've tried to find some existing apps that are based on WPF solely, and found WittyTwitter - there it seems that the text's context menu remains in English as well, but the whole app is English only so I can't really tell if maybe it's designed to be like that, or maybe it's really a WPF-based bug?
edit3: someone flagged this question as a dup of this one. Even though it might be more or less the same case, the answer there doesn't solve it (as I've described here), plus my question has more details to reproduce the problem.

'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.'

The exception in the title is thrown when I open a window in WPF, the strange thing is that this does not happen on my Windows 7 development machine nor does it happen when it is deployed on Windows 7.
I only get this error on Windows XP, and only the second time that I open the window.
Here is the code to open the window:
ReportParametersWindow win = null;
bool canOverWrite = _shownReports.Contains(rpt.FriendlyName);
if (!(canOverWrite))
win = new ReportParametersWindow(rpt.FriendlyName, rpt.ReportParameters, canOverWrite);
else
win = new ReportParametersWindow(rpt.FriendlyName, (container.ParametersWindow as ReportParametersWindow).Controls, canOverWrite);
win.ShowDialog();
And the XAML for the window:
<Window xmlns:my="clr-namespace:MHA.Modules.Core.Controls;assembly=MHA.Modules.Core"
x:Class="MHA.Modules.Reports.Views.ReportParametersWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Parameters" Height="500" Width="600" MinWidth="500" MaxHeight="500"
Icon="/MHA.Modules.Reports;component/Images/Parameters.ico" SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterScreen"
xmlns:odc="clr-namespace:Odyssey.Controls;assembly=Odyssey" Closed="Window_Closed">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" Name="ScrollViewer1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
<StackPanel Name="ParameterStack">
<my:LocationCtl Text="Parameters for report - " Name="loc"/>
</StackPanel>
</ScrollViewer>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<CheckBox ToolTip="This will replace the first report of the same type that was shown." Name="chkOverwrite" Content="Overwrite old" VerticalAlignment="Center" Margin="5,0"></CheckBox>
<Button Grid.Column="2" HorizontalAlignment="Right" Margin="5,0" Height="30" Style="{StaticResource DionysusButton}" Width="100" IsDefault="True" Click="Button_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/MHA.Modules.Reports;component/Images/Success.png"></Image>
<TextBlock Margin="5,0" Text="Accept" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Button>
</Grid>
</Grid>
Does anyone have suggestions?
The solution is quite a weird one but I have it figured out.
I realized that the error was occurring on the InitializeComponent() of the window, I then added a try catch to the constructor and showed the InnerException of the Exception.
The error that I received is "Image format not recognized".
I have no idea why this happens only on XP and the second time that the window is shown but by replacing my .ico with a .png the problem was resolved.
Hope this helps someone.
I just ran into this issue as well... I know this is old, but what I had to end up doing was set the images to Resource, and Copy Always... only by browsing my /bin/Debug folder did I realize that the images were not at a valid path location
This problem can also occur if the required image is not available at the specified location. So Check the inner exception and add any image that might have been missed or misspelled.
I got this error because my Command Binding of a Button was wrong:
<Button Command="MyCommand" />
instead of
<Button Command="{Binding MyCommand}" />
You Should first Import Image to your project
Solution Explorer - Show All
then Right Click on the image and select Include
Now Use
end
In my case the root cause was wrong BuildAction property on all images. I fixed it by changing BuildAction from Content to Resource.
I got this exception after moving my Resource Dictionary from root of my application to a subdirectory. In my case the problem were Image paths inside my Style setters inside the dictionary. After I preceded them with a forward slash '/', the application started to work again. If you're having a similar problem, open the resource dictionary, and the error will be highlighted with the blue 'squiggly' line.
In my case, I have added 'WpfToolkit' refrence to my module, and there is no need.
After deleting this reference, everything was ok. Strange!
Just go to Project>[Your Project Name] Settings and set your .ico file as icon now your .ico file is mentioned in your manifest file and you can simply include your .ico file in your XAML file using
Icon="[icon file name].ico"
<Window x:Class="[Your project's name].MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="" Height="500" Width="720"
Icon="[your icon's name].ico">
In my case, I found the mew added icon(image) file is not added into my project. It is resolved after I added these new image files into my project, not just file copy.
In my case the files existed on disk but were not referenced in the project. I added them to the project but the error persisted despite reloading the solution and restarting Visual Studio.
I changed the references to an existing file that was already in the project and it ran fine (albeit with the wrong graphic). I then changed it back to the original reference and it ran fine again but with the correct image. Presumably the error was getting cached somehow until it was flushed out of the system...
Remove the "WPFToolkit" reference from your cs.proj file.
<Reference Include="WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
It should do the trick.
copy and paste the file name is changed. that's why I get this error.
well, in my case I added the new photos to the image Folder in FileExplore while image folder was added to the project while ago. and there wasn't any problem with the image path in the project. but when I build the project I face to the same error.
then I add those new photos to project by right click on the image folder and add the existing item and selected new photos. then I cleaned the solution and build it again.
There are many ways to cause this issue. Since the exception isn't specific. Here is a list of solutions to try from this thread.
Firstly, you can try/catch the InitializeComponent() call which is throwing the exception to get more details about what happened.
If the image is an icon (.ico) file use an image (.png) or equivalent instead
In some cases .ico files are problematic - I was using .NETCore
Make sure your image file has a build action of Resource or Embedded Resource
The resource files described in this section are different than the
resource files described in XAML Resources and different than the embedded
or linked resources described in Manage Application Resources (.NET). - MSDN
Ensure your reference to the file is spelled and pathed correctly
Example: "/Resources/logo.png" if you have a folder at the project level
Notice the prefix /.
Colors codes in the xaml file missing the hashtag prefix "#000FE0"
In my case, another program was using the image and somehow was blocking the access.
I mad a copy and this worked.
<Window
.....
Height="450" Width="400"
Icon="../Resources/SettingsCopy.png" >
To improve upon user2125523:
If you've added the image to the project and checked and double checked that the file spelling is correct, try renaming the image to mirror a different existing image. Build/run, then put your image file name back and build/run again.
For example:
My original code kept throwing the OP error on LargeImage="/img/32/delete.order.png" even though this file exists.
<telerik:RadRibbonButton Text="Object Properties" Size="Large"
Name="PropertiesButton" IsTabStop="True"
telerik:ScreenTip.Description="Get object properties"
Click="PropertiesButton_Click"
LargeImage="/img/32/properties.png"
SmallImage="/img/16/properties.png" />
<telerik:RadRibbonButton Text="Reset Tab Order" Size="Large"
Name="ClearTabOrderButton" IsTabStop="True"
telerik:ScreenTip.Description="Reset tab order of all fields"
Click="ClearTabOrder_Click"
LargeImage="/img/32/delete.order.png"
SmallImage="/img/16/delete.order.png" />
So, I changed LargeImage="/img/32/delete.order.png" to LargeImage="/img/32/properties.png", ran the program, and changed it back to "/img/32/delete.order.png". Finally the error was gone.
FYI VS2012.3 Win8.1Preview
I had the same issue and to add an image to you solution you have to do it through the wizzard. In the solution explorer -> right click on the appropriate folder-> add existing Item -> and then browse to your image. That worked for me. Hope this helps.
Thanks for you answers.
Try to set Build Action of Property of Image file as Resource.
Exception used to occur within constructor. Button's command binding was incorrect.
Eg: <Button Command="MyCommand" />--> Wrong
<Button Command="{Binding MyCommand}" />--> Right
In my case, I got this error when I had
<Border Background="eeeeee">
instead of
<Border Background="#eeeeee">
(notice the missign #)
I found "UpdateSourceTrigger=Pr" somewhere in my XAML.
Must have happened during editing.
Compiling went OK, no error then whatsoever.
Setting a BreakPoint in Application_DispatcherUnhandledException in app.xaml.cs revealed the error.
Corrected to "UpdateSourceTrigger=PropertyChanged" and the world was at it should have been.
I work on Win 10 Pro, VS2017
I encountered this error and figured out that the Image Source path format has a mistake. a forward slash / was added as follows:
Source="/TestProject;component/Images//hat_and_book.png
I removed that extra slash and the error had gone.
I got the same error message, then I find this solution :
Image not displaying at runtime C# WPF
Find your folder:Go to properties of the added image, set Build Action =>as Resource and Copy To Output Directory =>as Copy if newer.
In My case I have wrote a border tag with height property then i had to remove the value leaving the property like this
<Border Background="{StaticResource MainBackgroundBrush}" BorderThickness="1" Height="">
</Border>
The Compiler gave me the same error but the IDE have no problem so after some hard search i have found it. so make sure every property is properly set. I hope this would be useful for anyone.
it is caused by Non-standard tag option in xaml to find it set
InitializeComponent();
Function in - try mode - like this
try {
InitializeComponent();
}
catch (Exception ex) {
MessageBox.Show(ex.Message.ToString());
}
now MessageBox(( show line number with incorrect setting in control .axml file.(it just show first incorrect line tag error after Corrected it then run app again and see next one)

Loading vector graphics from XAML files programmatically in a WPF application

I would like to load vector graphics stored as XAML files (separate files, not in a dictionary), embedded in my application, and I have a few questions to do so:
XAML looks a bit ambiguous, since it can be used to represent either static resources like vector images, or interfaces which are being dynamically built like the ones in WPF. Because of this, the format of a XAML vector image is unclear to me : what should be the root element, like the "svg" tag for svg vector images ? Currently, I'm using a Canvas as the top element since I want to plot my graphics in another Canvas.
What is the best method to load those file programmatically (I mean, to create the Canvas from the xaml files) ? I've seen (and tried) different solutions with XamlReader, but nothing worked: the app crashes and the debugger does not help (most problems I've encountered seem to occur during the parsing, and the error message was unclear).
I've read http://learnwpf.com/post/2006/06/04/How-do-I-Include-Vector-Based-Image-Resources-in-my-WPF-Application.aspx, but the link to the article dealing with resource files loading is dead, and the images are not created using C# code.
Okay, I found the solution by myself and here it is :
My project is named "Editor", and I've placed the XAML file I want to read in a "Graphics" folder. This file is named "Image.xaml".
The project tree looks like this :
The XAML file itself holds this code :
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Width="40" Height="40">
<Rectangle Canvas.Left="0" Canvas.Top="0" Fill="White" Stroke="Black" StrokeThickness="1" Height="40" Width="40" />
<!-- ... -->
</Canvas>
(the xaml namespace 'xmlns' reference is needed)
The code used to load the file is :
StreamResourceInfo sr = Application.GetResourceStream(new Uri("Editor;component/Graphics/Image.xaml", UriKind.Relative));
Canvas result = (Canvas)XamlReader.Load(new XmlTextReader(sr.Stream));
layoutRoot.Children.Add(result);
'layoutRoot' being the name of the main Canvas of my application.
Last subtility : the property 'BuildAction' of the *.xaml file must be set to 'Resource', or you will encounter a XamlParseException with hexadecimal value 0x0C (to change this property, right-click on the file in the project treeview).
Hope this can help.

WPF - Bind a ListView to a .xml file dynamically

Is there a way (using the MVVM pattern) to dynamically bind a ListView to an xml file?
Actually the ListView is binded to a static path, like:
C:\DocumentsAndSettings\blabla\morebla\log.xml
I need something like
AppPath\log.xml
Here's my code:
in the View.xaml:
<ListView ItemsSource="{Binding Source={StaticResource logDataSource}, ...
in the App.xaml:
<XmlDataProvider x:Key="logDataSource"
Source="C:\DocumentsAndSettings\blabla\morebla\log.xml"
d:IsDataSource="True"/>
I'd like something like this:
<XmlDataProvider x:Key="logDataSource"
Source="AppPath\log.xml"
d:IsDataSource="True"/>
Thank you in advance.
Why don't you just use relative paths? For example, if you put your log.xml in data directory in your project, simply write
<XmlDataProvider x:Key="logDataSource" Source="data/log.xml" />
Note that the file should have a build action of "resource".
Or if it's a "content" then set copy to o/p directory to "copy always".
(Search for difference b/w these two on Google)
If I put the log.xml file in my project directory, the logger library will write in the
project/bin/debug/log.xml
while the xaml binding will look for log.xml in
project/log.xml
I solved the problem setting the property of the log.xml file to "Content" not to "Resource"..even if I really don't know the difference :)

Categories

Resources