|
Can anybody see what's going wrong here? I get an empty grid with a blank row for each item in the ObservableCollection .
<Custom:DataGrid Width="454" Height="396" Canvas.Left="8" Canvas.Top="4" Name="gridEvents" FontWeight="Bold" FontFamily="Nina"
AutoGenerateColumns="False" SelectedIndex="0" FontSize="10.667" >
<Custom:DataGrid.Columns>
<Custom:DataGridTextColumn x:Name="dgCol_EVStatus" Header ="Status" FontWeight="Normal" IsReadOnly="True" />
</Custom:DataGrid.Columns>
</Custom:DataGrid>
and
dgCol_EVStatus.Binding = new System.Windows.Data.Binding("Status");
ObservableCollection<RIAudit> _Audits = new ObservableCollection<RIAudit>();
_Audits.Add(auditRec);
gridEvents.ItemsSource = _Audits;
|
|
|
|
|
redivider wrote: AutoGenerateColumns="False"
I think you want "AutoGenerateColumns="True""
corrected spelling
My bad I did not read the entire thing obviously. You don't need the Autogeneratecolumns since you describe one already. But what happens if you let the grid autogenerate the columns for you? And/or the grid might not understand how to display an RIAudit object.Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
modified on Tuesday, February 23, 2010 5:34 PM
|
|
|
|
|
Hmmm.. Figured something aggravating out. RIAudit, out of necessity, uses public properties, instead of accessors. If i change
public string Status;
to
public string Status {get; set;}
then WPF is happy (though the object-ralational database i use is not).
I guess I'll have write a wrapper for RIAudit, unless someone knows how to get around this. ??
|
|
|
|
|
Every one of us has downloaded dozens of executable files from the Web, but for the life of me I can't find out how this is done. Every time you go to a commercial site that offers software for free or for sale, you can click on a download button and a standard dialog with the title, "File Download - Security Warning," pops up with Run, Save, and Cancel buttons.
What do you have to do to bring up this dialog? This obviously isn't a Silverlight-specific question, but searching the general Web forums mysteriously don't seem to answer this question, either. But I have to get this standard dialog coming up from my Silverlight app. If you could just point me to the right subject in a book somewhere, I'd be eternally grateful.
I know there are security issues about downloading executable files. Nevertheless it's done all the time, through this standard "File Download - Security Warning" dialog that is undoubtedly available through thousands of Websites. I don't understand why this seems to be such hidden knowledge. I have several books on Website development and there isn't a word about this in any of them. Where is it actually documented how to do this?
|
|
|
|
|
This shouldn't be difficult for someone whose been a programmer for as many years as you!
|
|
|
|
|
Richard Andrew x64 wrote: This shouldn't be difficult for someone whose been a programmer for as many years as you!
I've never done any Web programming. Silverlight is my first exposure to it. It's been desktop programming for me ever since I landed my first job that required development for a PC back in 1988. Now desktop programming is passé and I need a new career.
I went to the bookstore today and looked through a bunch of ASP.NET books and Website development books and couldn't find a single one that mentioned this standard "File Download - Security Warning" dialog. If you know the answer, please let me know what it is. Evidently I don't even know the technology that puts out this dialog, so I don't know what kind of a book to look in for the answer.
I also read about the Silverlight SaveFileDialog class, hoping it would give me something like what I need, but the examples I'm seeing are very confusing. I was hoping I would be able to get a Stream from a file on my Website and be able to call some function in the SaveFileDialog class that would let me feed that stream into a file I would browse to with the SaveFileDialog.ShowDialog method, and then save the file with that stream, but evidently that's not how it works. There isn't even a Save method in this class, only an Open method. The OpenFileDialog class has methods like Create and OpenWrite but they are restricted for internal use only.
All I want is hint of where to look to do the research. I don't even know what I should be studying.
|
|
|
|
|
I apologize for my sarcasm, but it seemed funny at the time.
As far as I know, the dialog box you're talking about is the duty of the browser to show.
The web server simply serves the file, with its associated MIME type being listed in the HTTP headers.
Now, if the browser sees that it is not a file used for rendering a web page, first it looks to see if it has a registered handler for that type of file. For instance, a WAV file would trigger the browser to launch Media Player.
If there is no registered handler for the specific type of file, then it would open the Save As dialog box.
|
|
|
|
|
I don't know Silverlight, but I would guess that it's probably up to you to implement and launch the Save As dialog box yourself.
When you want to download the file in question, open an HTTP connection to the URL, then once you have that, launch the Save As dialog box for the user to choose a location to save the file.
Then all you have to do is alternately read the network stream and write the file.
|
|
|
|
|
There is a SaveFileDialog class in Silverlight, but it doesn't do what you're speculative Save As dialog would do. I believe I have to read about Isolated Storage and the ways around it.
I believe I know how to download a System.IO.Stream from my Website. The problem then is saving that stream outside of Isolated Storage, which is a security violation. But there must be a way to ask to do that, which forces out the "Download File - Security Warning" dialog. I just have to figure out how to do that.
|
|
|
|
|
I'm not the expert on Silverlight, but I would suspect that the only way to break out of Isolated Storage is by installing your application as a full-trust app, which is not possible for a web application.
Read about the different trust levels, that may provide some clues.
|
|
|
|
|
I know that Websites successfully download executable files all the time. Any Website that sells its programs where you can download them right there on the spot does it. There's nothing special the user has to do to enter the Website. All they have to do to get the download is to go through the "Download File -- Security Warning" dialog.
Maybe there is no way around it if all your Website programming is in in the Silverlight app, which runs on the client. But Silverlight doesn't have to be the whole site. It can just be part of it. I have developed a commercial desktop program that I want to sell through the Web, and I have contracted a Website developer that is doing the bulk of the Website programming for me (since I'm out of my league there). He can't figure out how to download my installation program, which we've uploaded to the Website itself. He says he's "still working on it." I was just fishing around up here to see if anyone had any ideas.
Turns out I was probably asking the wrong question. Unfortunately, I still don't know what the right question is.
|
|
|
|
|
Well let's be clear, it's not the website that's downloading the file when you purchase a program over the net.
It's the user and his browser who is downloading the file. That's why the system allows you to save the file anywhere you want, because it's you doing it.
On the other hand, your Silverlight app is restricted in where it can save files because it's not under the direct control of the local user, and it could very well be malicious. ( Not that yours is malicious, just saying...)
Maybe there is a way you can have your app direct the browser itself to the URL from which it can download the file, and that would provide the functionality you seek.
|
|
|
|
|
This isn't a Silverlight problem. I have to put a regular HTML page behind our Silverlight Download button.
|
|
|
|
|
Maybe I'm looking at this the wrong way. Maybe the "File Download - Security Warning" dialog is coming directly from the Windows operating system because you're trying to write a file to the local machine from a Web browser. So maybe my question should be, how do I write to a file outside of Isolated Storage? Once I know how to get around the security issues that prevent that, the "File Download" dialog will be produced automatically. Please let me know. Am I on the right track? I just need some guidance here.
|
|
|
|
|
I can tell with some certainty that that dialog box is coming from the browser, as evidenced by the fact that Firefox has its own version of it which is different from IE's version.
As I said above, read about trust levels.
|
|
|
|
|
This is achieved by the use of Mime types and is very easy to do. Consider the following sample ASP.NET page
:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="~/googletoolbar2user.exe" runat="server">Exe</a>
</div>
</form>
</body>
</html> Clicking the link when it's running prompts the browser to display the warning you're after. Have a look at this post[^] to see more information on what you need configuring in IIS. There's no special voodoo, and I'm not surprised that books on ASP.NET don't teach this as it's more about general web development rather than Silverlight/ASP.NET issues."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
So in otherwords, behind our Silverlight Download button, we have to put a regular HTML page like your example. Now it's making a heck of a lot more sense. Shows how ignorant I am of this entire world of Web programming. Thanks a lot. It probably sounds incredibly basic to you, but all this is entirely new to me, so new that I don't even know how to pose the right questions.
|
|
|
|
|
Maybe im being silly but the simplest solution I can think of is to embed the silverlight in a HTML page which this javascript function:
function redirect(url){
window.location=url;
}
and then call that JS from silverlight with "http://domain.com/file.exe".Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
We've already got a fairly elaborate Silverlight app. So without refactoring the entire design, we have to work from Silverlight to HTML, not the other way around. I'm thinking of taking a rather crude approach: HtmlPage.PopupWindow, with the URI parameter to PopupWindow pointing at the HTML page that downloads the executable. If there's a more elegant solution someone could suggest (I'm sure there must be), I'd be grateful to receive it.
|
|
|
|
|
Well, you can set the URI straight to the exe to popup the download window. Therefore skipping the extra HTML page. Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
|
Hi,
I'm working in a silverlight aplication.
In the web project I built a domain service after create a ADO entity model. In the client project i can invoke the web project service methods.Everything is fine here.
But, now i add just a domain service(in the web project) and defined some methods here.The problem is when i try to access this methods in the cliente project. I can instantiate the service and invoke the method but it does not anyting. Do i have to give some special treatment when i call the service methods on the client project?
(Excuse my english but i do not speak it very weel )
thanks. regards jonatan
|
|
|
|
|
I'm developing a WPF Facebook application, and I was wondering whether there is any way that I can persist login information, so that users don't have to repeatedly type in their passwords everytime they want to view photos etc. Or lets say I have a bunch of passwords stored in a database, how can I log in to Facebook using that specific password without the user having to type it in?
I'm using the following to create a session:
session = new DesktopSession("[app key]", null, null, true,
new List<Enums.ExtendedPermissions>() { Enums.ExtendedPermissions.read_stream, Enums.ExtendedPermissions.publish_stream });
session.Login();
|
|
|
|
|
Hello everybody,
I have added a new xaml page in my silverlight project, but I don't know how to host it into a new aspx page rather, how do I do that? What I mean is I'm trying to have multiple silverlight(xaml) pages in one project and hosting them in different aspx pages.
Thank youmodified on Tuesday, February 23, 2010 7:55 AM
|
|
|
|
|