silverlight

CrossDomain error

六眼飞鱼酱① 提交于 2020-01-14 11:26:49
问题 I have hosted my Silverlight application in IIS, now when I try to access the application I get the following error System.ServiceModel.CommunicationException: an error occured while trying to make request to URI This could be due to attempting to access a service in a cross-domain way without proper cross-domain policy in place, or policy that is unsuitable for SOAP services..... I have placed the cross-domain policy properly in wwwroot as well as in the virtual directory. <?xml version="1.0

Keep same layout when orientation changes

我与影子孤独终老i 提交于 2020-01-14 10:44:51
问题 I have a Silverlight page that I would like to have below appearance in portrait and landscape mode. Essentially, there are three images arranged in a grid. The big image spans two columns. When the phone rotates, the images rotate, but the overall layout does not. The small images remain close to the back/windows/search button and the large image remains towards the top of the phone. I have tried a number of methods to achieve this effect, but they have all proved unsatisfactory in one way

How do I create a GetEnumValues extension method in Silverlight that works the same way as in .NET?

杀马特。学长 韩版系。学妹 提交于 2020-01-14 10:18:07
问题 Below is a piece of code I find useful in that I can use it to nip round enums quickly. CurrentEnum stores a reference to the enum that was used to provide the strings, in this case "Bald" and it can change. What I am trying to do is replicate the same functionality in Silverlight which does not have a GetEnumValues function. The preferable solution would be an extension method that can be used in the same way as in my example below. class Program { enum Cats { Fluffy, Furry, Bald }; enum

What is the Response.Redirect equivalent in Silverlight?

烈酒焚心 提交于 2020-01-14 10:11:44
问题 I need to go another page or url. What is the response.redirect in silverlight? 回答1: If you want navigate to another page of Silverlight Navigation Application: NavigationContext.Navigate( new Uri( "/Views/Home.xaml", UriKind.Relative ) ); where NavigationContext - Page property If you want navigate to another url: System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("http://stackoverflow.com"), "_blank"); 来源: https://stackoverflow.com/questions/7378037/what-is-the-response-redirect

F#: Add and remove event handlers

天大地大妈咪最大 提交于 2020-01-14 09:48:24
问题 I'm trying to add & remove an event handler from a Silverlight FrameworkElement, but I just can't get the syntax correct. I want to do something like this: let clickedEventHandler = fun args -> printfn "Click!" fe.MouseLeftButtonDown.AddHandler( clickedEventHandler) ... fe.MouseLeftButtonDown.RemoveHandler(clickedEventHandler) What should be the correct way to do this? 回答1: As you already mentioned, you need to create an instance of delegate: let ch = new MouseButtonEventHandler(fun obj args

How do we set background image of TextBlock in Windows Phone?

我与影子孤独终老i 提交于 2020-01-14 09:46:06
问题 I am facing problem in setting the background of textblock in Windows Phone. <TextBlock Text="Forget Password" Height="19" Width="156"> 回答1: You can try this: <Grid> <Grid.Background> <ImageBrush ImageSource="MyImage.jpg" /> </Grid.Background> <TextBlock Text="Forget Password" /> </Grid> 回答2: The TextBlock element cannot display a background image. You can display an image behind your TextBlock as follows: <Grid> <Image Source="..."/> <TextBlock Text="Forget Password" Height="19" Width="156">

Silverlight 4: Listbox doesn't shrink when its items shrink

為{幸葍}努か 提交于 2020-01-14 09:33:29
问题 from this question, I drilled down the problem to a listbox, that doesn't resize, when the Listbox-Items shrink. It resizes accordingly, when the size of the items grow, but it doesn't shrink, when the size of the items decrease. The items can grow/shrink because the items containing textboxes, that resize with the input. Jeremiah suggested to start a new question with more code to show, so here we go: Our evil listbox is part of a UserControl, that contains a StackPanel with a Label

Size a TextBlock to a Button that changes Width dynamically

…衆ロ難τιáo~ 提交于 2020-01-14 05:27:07
问题 I have a TextBlock that's on top of a Button in a Grid . I'd like to have then displayed thus: "some very long text" <-- text "that doesn't fit" <-- text wrapped [my button text size] <-- button However, what I've got is this: "some very long text that doesn't fit" <-- text [my button text size] <-- button My issue is that the text in the Button is dynamically set through localized resource and therefore the width of the button changes dynamically. The static solution that works for non

How do I choose files from the local filesystem in Windows Phone 7

血红的双手。 提交于 2020-01-14 04:44:09
问题 I'm trying to choose some files to upload in Windows Phone 7 (in the emulator), and any attempt to ShowDialog of the OpenFileDialog leads to a Security Exception. The open file dialog is being called from an event on a button click but I get a SecurityException [FileDialog_ActiveScripting] Arguments: Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40806

“Read-Only” Entity Framework? I'm trying to use RIA Services, EF, and Silverlight

和自甴很熟 提交于 2020-01-14 04:14:18
问题 I'm trying to present MySQL server data in a silverlight client and my current plan of attack is to use Entity Framework to MySQL with RIA Services providing the data access between the Silverlight Client and Entity Framework. However, I'm only trying to present data to the user and I do not want the possibility of me or someone else being able to change the data in MySQL. In short, I wish there was a way to simply ignore the setters for all entity types. I only want getters. I want "read