silverlight-4.0

XAML ContextMenu gets bound to wrong row in a DataGrid

我们两清 提交于 2019-12-11 12:33:01
问题 I have a XAML based ContextMenu bound to the rows in a datagrid. It works just fine - until the grid is scrolled! This is the context menu for one of the controls in the visual tree or a DataGrid row. <data:DataGridTemplateColumn Header="Customer Details" Width="*"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid Background="Transparent"> <!-- allows click in entire cell --> <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu>

How can I display a BusyIndicator during printing in Silverlight 4?

一个人想着一个人 提交于 2019-12-11 12:31:35
问题 I want to display a BusyIndicator during printing. If I turn on my BusyIndicator in the BeginPrint event and turn it off in the EndPrint event, it never appears (BusyIndicator.DisplayAfter is set to 0). I assume this is because the actual printing is taking place on a different thread. So if I turn it on before actually calling PrintDocument.Print, the BusyIndicator does show, but of course that's not what I want (the BusyIndicator appears when the user is just selecting his/her printer

save png file in application image folder without using savedialogfile

久未见 提交于 2019-12-11 12:09:34
问题 I save a png file using savedialogfile. But I want to save it in application IMG folder. My code is as follows: if (lastSnapshot != null)//writableBitmap object lastSnapshot { var dlg = new SaveFileDialog(); dlg.DefaultExt = ".png"; dlg.Filter = "PNG File|*.png"; if (dlg.ShowDialog() == true) { using (var pngStream = GetPngStream(lastSnapshot))//return Stream type using (var file = dlg.OpenFile()) { byte[] binaryData = new Byte[pngStream.Length]; long bytesRead = pngStream.Read(binaryData, 0,

How to consume WCF in silverlight app

烂漫一生 提交于 2019-12-11 12:05:40
问题 I want to know how I can consume a normal WCF service (not Silverlight enabled WCF service) in my Silverlight application. Here is what I tried I have created a simple normal WCF service I changed the binding to basicHttpBinding in the web.config file I have placed clientaccesspolicy.xml and crossdomain.xml files in wwwroot folder. But even though I am unable to consume the WCF service. I get this exception System.ServiceModel.CommunicationException was unhandled by user code Message=An error

Silverlight 4: why items are not moveable?

大城市里の小女人 提交于 2019-12-11 11:34:44
问题 There is a "field" on which some items are draggable: Here is a XAML code: <Canvas Height="180" Width="169" > <Image Canvas.Left="0" Canvas.Top="0" Height="180" Width="149" Source="../Picts/field.png" /> <Pages:FieldItem x:Name="Item2" Canvas.Left="129" Canvas.Top="34" MouseLeftButtonDown="Item1_OnMouseLeftButtonDown" MouseLeftButtonUp="Item1_MouseLeftButtonUp" MouseMove="Item1_MouseMove" /> </Canvas> And code-behind: private bool bIsCaptured = false; double mouseVerticalPosition; double

Change DataTemplate to use depending on condition

天涯浪子 提交于 2019-12-11 10:51:28
问题 I have 3 user controls Control 1 Control 2 Control 3 I have a stack panel that contains an ItemsControl <UserControl.Resources> <DataTemplate x:Key="Template1"> <my:UserControl1 Height="117"/> </DataTemplate> <DataTemplate x:Key="Template2"> <my:UserControl3 Height="117"/> </DataTemplate> <DataTemplate x:Key="Template3"> <my:UserControl3 Height="117"/> </DataTemplate> </UserControl.Resources> <StackPanel Name="stackPanel3" Orientation="Vertical" VerticalAlignment="Bottom" Width="Auto">

Exception in brand new Silverlight project

别说谁变了你拦得住时间么 提交于 2019-12-11 10:44:00
问题 I am getting the following exception message when I try to run my newly created Silverlight app: An error occurred while trying to make a request to URI 'http://localhost:8732/Design_Time_Addresses/IsAProgrammer.Service/Service1/'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to

save png file in application image folder in silverlight

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 10:37:09
问题 I save a png file using silverlight. But I want to save it in application IMG folder. My code is as follows: if (lastSnapshot != null) { string ImageName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".png"; string filePath=System.IO.Path.Combine("~/Images/", "" + ImageName + ""); using (var pngStream =

Post Method in Webclient

痴心易碎 提交于 2019-12-11 10:31:51
问题 web service post method is new for me. can u pls help me out what am i doing wrong. WebClient webClient = new WebClient(); webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; webClient.Encoding = Encoding.UTF8; webClient.UploadStringCompleted += new UploadStringCompletedEventHandler((sender, e) => { if (e.Error != null) { return; } string result = e.Result; }); string uri = "http://localhost:60696/service/getlogin/"; StringBuilder postData = new

How to place a WebBrowser control below other controls?

别来无恙 提交于 2019-12-11 08:56:58
问题 I tried setting the Canvas.ZIndex property, but when I scroll, the HTML in the webBrowser control still floats above the menu bar in the Silverlight navigation application. You can see the sample code below: I just created an empty Silverlight Navigation Application and added the following in Home.XAML: <navigation:Page x:Class="Test.Home" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft