silverlight

How does one detect SetBinding success or failure in Silverlight?

跟風遠走 提交于 2020-01-03 17:23:46
问题 Simple binding from C#: Binding binding = new Binding(SourceName); binding.Mode = BindingMode.TwoWay; BindingExpressionBase beb = SetBinding(SourceDependencyProperty, binding); I would like to detect whether or not the SetBinding was successful. SetBinding obviously knows when it has an issue because it displays in the Output window tracing when the application is running: System.Windows.Data Error: BindingExpression path error: 'InterestRate' property not found on 'Tc.Views.TestAccount' ...

Blendability with d:DataContext. What am I missing?

余生长醉 提交于 2020-01-03 15:30:29
问题 I feel as though I still see a lot of guidance and advice stating that a view-first approach is the best way to go to get Blendability in your application. However, with d:DataContext, d:DesignData and d:DesignInstance, isn't the problem of Blendability easy to solve regardless of how your views and viewmodels are wired together? With DesignInstance, you simply pick a concrete ViewModel type to be used in the designer, and it's as if you've got view-first composition. In fact, using

Silverlight Defaulting ContentPresenter Content

瘦欲@ 提交于 2020-01-03 14:15:18
问题 Why won't this work? In generic.xaml for a custom control: In the style applied to the custom control... <Setter Property="ChromeContent"> <Setter.Value> <Grid /> </Setter.Value> </Setter> ... Later, in the control template... <ContentPresenter Grid.Column="0" x:Name="ChromeContentPresenter" Content="{TemplateBinding ChromeContent}" /> Here's the dependency property for ChromeContent... public Object ChromeContent { get { return (Object)GetValue(ChromeContentProperty); } set { SetValue

Sending large XML from Silverlight to WCF

淺唱寂寞╮ 提交于 2020-01-03 12:59:57
问题 I want to send a big XML string to a WCF SVC service from Silverlight. It looks like anything under about 50k is sent correctly but if I try to send something over that limit, my request reaches the server (BeginRequest is called) but never reaches my SVC. I get the classic "NotFound" exception. Any idea on how to raise that limit? If I can't raise it? What are my other options? Here's my binding configuration <bindings> <customBinding> <binding name="customBinding0" maxReceivedMessageSize=

AutoCompleteBox Dropdown width

只谈情不闲聊 提交于 2020-01-03 12:59:41
问题 Can the width of the dropdown be set to a different value than the AutoCompleteBox itself? 回答1: The Popup is a separate Part of the AutoCompleteBox, so it should be possible to extend that beyond the width of the text box. In Blend, right-click on the AutoCompleteBox and select Edit Template > Edit a Copy, giving the new template a name. Drill-down in the Objects and Timeline window to the 'Popup' part, and beneath that is a Grid. Change the width of that Grid to change the width of the popup

WPF Design Time View Model

好久不见. 提交于 2020-01-03 12:14:19
问题 I have a simple view model that has a list of Units in it, this shows fine in run time, but I would like the list to show in design time. As per some questions around I have tried the following, but it is not working, can someone please help? //In resources <local:MainViewModel x:Key="DesignViewModel"/> The Presenter <ItemsControl ItemsSource="{Binding Units}" d:DataContext="{Binding Source={StaticResource DesignViewModel}}" Background="Transparent"> The view model public MainViewModel() {

Capture print dialog's cancel in silverlight printing

爷,独闯天下 提交于 2020-01-03 10:44:54
问题 Does anyone know if you can find out if the print dialog's cancel was clicked? I've seen post and doc that say "EndPrint – Event fired when the printing is either completed or canceled. " But I don't think that is the print dialog's canceled... I think the is if the print job is canceled. thanks 回答1: Based on the documentation, I don't believe there's an easy way: http://msdn.microsoft.com/en-us/library/system.windows.printing.printdocument.endprint(v=VS.95).aspx In particular: The EndPrint

Should WebClient instances be reused in Silverlight

五迷三道 提交于 2020-01-03 08:07:08
问题 I'm writing a Silverlight application for Windows Phone 7 which has a class that needs to make multiple requests to WebClient.DownloadStringAsync() Am I better off creating a new instance of WebClient for each request, or is it more efficient to initialise a single instance in a field and use that for each request (making sure to only have one request active at any one time)? public class MainViewModel : INotifyPropertyChanged { private readonly WebClient _wc; public MainViewModel() { _wc =

How to use a literal curly brace “{” in XAML?

。_饼干妹妹 提交于 2020-01-03 06:45:09
问题 I need put in } and { in a XAML ConvertParameter without it being interpreted: ConverterParameter = "{0}/{1}" ...which does not work. How to do this? 回答1: You can use: ConverterParameter = "{}{0}/{1}" More information can be found here. 回答2: Use {} as the escape sequence. ConverterParameter = "{}{0}/{1}" 回答3: For those who got here looking for the answer for WinRT-XAML. The escape sequence is \ sign. Although this documentation states ' should work but on the other hand this example uses \

Is there a way to get frame number in Silverlight MediaElement object? [duplicate]

浪尽此生 提交于 2020-01-03 06:40:08
问题 This question already has an answer here : Closed 8 years ago . Possible Duplicate: silverlight media player with frame counter We want to know whether we can get frame number? 回答1: If you know the frames per second (FPS) then you multiply the FPS times the position in the media. MediaElement does not have a way to directly query the FPS. 来源: https://stackoverflow.com/questions/3193989/is-there-a-way-to-get-frame-number-in-silverlight-mediaelement-object