https://xamlmarkupextensions.codeplex.com/
I'm having a problem using the xamlmarkupextensions library. This library provides the opportunity to Bind values from a resource file (resx) to different controls. Now this works perfectly, but I don't want to use the resource file... I would like to use my own database.
So I made a new database and tried some stuff and got it working. The only problem is that the value is not visible in design time... Does anybody here knows how this could work? Thanks in advance!
Related
I am using Telerik RichTextBox Editor(the one like MS Office) in my WPF project. When I save a file, and attempt to save it again later after making changes it opens up the SaveFileDialog and asks for the file name even though I've already defined it and saved it (like it thinks I'm using Save As, rather than Save). How can I solve this issue??
I am using
<telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=SaveCommand}" Size="Small"
SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/save.png" Text="Save" />
Didn't got a solution yet from anyone. Working on it, have some progress using CustomSaveCommand. Will post a complete solution when I get one.
If anyone gets one before I do, I'll accept it. Thanks all.
Solution:
Got a solution. Created a custom OpenCommand using the CustomSaveCommand and radrichtextbox-Import/Export. Hold in a string variable, the full path of the file on open/save a document, and overwrite the file on next save without the filedialog. Also reset the variable on new file open. Hope it helps anyone who is searching for a solution. Cheers :)
You could possibly setup a custom filebrowser provider and do what you want in there, i.e. see custom filebrowsercontentprovider. Besides a few other bits and bobs just inherit from Telerik.Web.UI.Widgets.FileBrowserContentProvider class.
Here is a nice example of using a sql database for the files: sql database
I seek a little bit of advice...
I have an WPF C# program with an XML resource file in which I have text for some buttons, like a language file (let's call it language.xml), and 2 xml more, for example english.xml and spanish.xml.
I have the XmlDataProvider pointing to language.xml
At startup I seek in a database which language has the user in his/her configuration, and I overwrite language.xml with the content in english.xml or spanish.xml
Sometimes the program loads right, but most of the time it loads the wrong data, although you look in the language.xml and the data is right.
(When I say wrong data I mean loading the program and entering with one user with a language set, closing, and entering with another one with other language...).
It's a little bit confusing, but I hope someone have tried something like this...
Thank you in advance. :)
May be problem is in synchronization.
As example, your program begin request to database, and starts UI. XmlDataProvider is created with old xml source, then (on service response) language.xml is rewritten with new value.
More details or code parts will help to understand your situation.
Ok, got it. I had to reload the XmlDataProvider in the Loaded method.
In addition, seeing that I had to reload the XmlDataProvider itself, I set it to point directly to the correct .xml file. :)
Thank you for your answers!
You need to debug and see exactly where things get initialized ?
It would be quite simpler to have just set the language and point to the correct xml file rather than your language.xml file.You already have two language files so why do do need additional operations ....
Try to simplify and then see if you still get the proplem.
Quick 1 sentence summary: I wrote a demo app [download src here][1] that doesn't properly display sample data in the Visual Studio Designer and I need help.
After 6+ years developing in C# and WinForms, I've decided to use WPF in my current project. I've written a small demo application to teach myself and experiment with WPF (you can see a screenshot [here][1]). The app simply downloads and displays recent news stories from the Google News RSS feed.
My first attempt at this resulted in the class called "GoogleNewsWidget." After reading about the MVVM model, however, I tried again and built "GoogleNewsWidget2" that attempts to utilize a more MVVM-oriented architecture. I'm not sure which implementation is best as they both seem to be working fine on the whole (and though I'd appreciate comments on which is better, it is not my primary question).
My main problem is that neither play very well with the Visual Studio Designer. The GoogleNewsWidget2 loads and displays data fine when its xaml is opened directly but does not display correctly when embedded into another xaml file . The GoogleNewsWidget does not display data in the Designer in either case.
Any help would be appreciated. Again, the source is available for download [here][1].
Thanks,
Jon
[1]: http://abstract.cs.washington.edu/~jfroehli/reflect/ Demo App Source Code
PS My original post had multiple hyperlinks to screenshots but its posting was denied by StackOverflow for spam prevention reasons. Thus, I created the [1] url, which contains screenshots and a link to source code. If someone could also help me figure out how to use the "Markdown" language for linking, I'd be grateful. :)
Assuming that the VS2010 designer works the way Blend 3 does, you have to provide "dummy" data -- the designer won't pull data from external sources.
Create an object that implements the same interface as your datasource (view model) and fill it with static data. Make sure it has a public, no-arg constructor.
Define it as a resource in your control, giving it a key like "DesignData".
In the root element of your control, add the attribute d:DataContext={DynamicResource DesignData}"
This will be used as the DataContext only when in the designer.
Ok this is something new to me....
I have a gridview control which is displaying the files and directory names in one column.
Now i want to display the file icon of that particular file in the other column...
eg test.txt will have a different icon form image1.jpg and here.xsl
i have found two examples but don't kno if they will work or not....
http://www.codeproject.com/KB/custom-controls/AssociatedIconsImage.aspx
or
http://forums.asp.net/t/90921.aspx
how to incorporate this with my gridview..?
thanks
I found a source that should be useful for you (and with a simple google query btw.): Getting Associated Icons Using C#
.
As far as I know, there's no other way than using the shell32 library via interop, as used in the given example.
I'm not sure if there is a managed way to this... there very well could be, but the unmanaged way to get this would be to use PInvoke to call SHGetFileInfo. There is sample code on PInvoke.Net which should get you most of the way there.
Related to this question I asked earlier, I wonder if it's possible to also dynamically load a code-behind file that is paired with a XAML file. Can it work this way or would it just be better to compile both into a DLL?.
Thanks!
Actually, it's the code-behind that loads the XAML file. The designer generates a hidden file that binds all of your named elements and events to the class. (Notice the 'partial' keyword on your class in the code-behind.) It functions similar to the file that the WinForms designer generates, only it's a bit harder to find. You can find them in the "obj/debug/" folder along with the compiled BAML.
As for actually answering your quetion, it would be better to compile them to a DLL. It may not be impossible to set up a library that can connect a XAML to a special class that has methods to dynamically access elements, but there's nothing like that now as far as I know.