silverlight-2.0

silverlight: How to set attached properties Programmatically

女生的网名这么多〃 提交于 2019-12-03 01:24:01
Suppose I have a grid with some row definitions, and a child control in that grid. How would I go about setting the Grid.Row property of the child control programatically? To set the value: textBlock.SetValue(Grid.RowProperty, 3); To reset the value: textBlock.SetValue(Grid.RowProperty, null); Actually to clear a value you should use this: textBlock.ClearValue(Grid.RowProperty); I'm not 100% sure this is in SilverLight, but in WPF you call a static method (called SetX, where X is the property) on the type the attached property is defined on and pass it in which control to set the value on, and

Silverlight Error “Layout Cycle Detected Layout could not complete” when using custom control

六月ゝ 毕业季﹏ 提交于 2019-12-02 19:27:50
I'm building a custom control in Silverlight by deriving from ContentControl and doing some special formatting to put a dropshadow behind the contents. I've nearly got it working but have recently ran into a bizarre error. It works fine if it contains anything besides a Border, or a Grid/Stackpanel/etc that does not have an explicitly defined height and width. I get a JavaScript error in IE, and the text says: Runtime Error 4008... Layout Cycle Detected... Layout Could Not Complete. If I specify a height and width on the contained grid/stackpanel/etc it works fine. There is a ton on the web

Does Silverlight XAML Support The Byte Data Type?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 03:03:26
问题 Here is my data type: using System; namespace UI { public class AddressType { public byte ID { get; set; } public string Name { get; set; } } } Here is my collection: using System.Collections.ObjectModel; namespace UI { public class AddressTypes : ObservableCollection<AddressType> { } } Here is my XAML from my UserControl.Resources section of my page: <local:AddressTypes x:Name="AddressTypesList"> <local:AddressType ID="0" Name="Select"/> <local:AddressType ID="1" Name="Office"/> <local

Silverlight - Getting the Domain Information

笑着哭i 提交于 2019-12-02 00:41:28
How does a Silverlight application ask the browser what domain its being served up from? UPDATE: Make sure if your class doesn't already have this using statement add it at the top your class. This will help you on some of the examples you'll see online. It confused me for a bit. using System.Windows.Browser; How about HtmlDocument.DocumentUri ? That'd get you what you need. Page about browser interop here . As jcollum says you access the HtmlDocument.DocumentUri property to get lots of information on the host. To answer the question in your comment this is how you do this in Page.xaml.cs:

How do I pin one control below another in Silverlight?

左心房为你撑大大i 提交于 2019-12-01 22:25:41
I have a project that uses a DataGrid with a custom template so that I can add a special row to the bottom of the data rows. I would like this special row to be pinned under the last row but not as part of the ScrollViewer , such that it remains pinned under the last row until the bottom of the special row hits the bottom of the data grid, then I would like the rows region to size to the space inbetween and scroll accordingly, with the special row always visible. So far, I have my special row as part of the ScrollViewer along with the RowsPresenter . Both the presenter and the special row are

XamlParseException: Attribute in custom control missing, but it's defined!

心已入冬 提交于 2019-12-01 14:29:27
I sometimes get the following exception for a custom control of mine: XamlParseException occurred Unknown attribute Points in element SectionClickableArea [Line: 10 Position 16] The stack trace: {System.Windows.Markup.XamlParseException: Unknown attribute Points on element SectionClickableArea. [Line: 10 Position: 16] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at SomeMainDialog.InitializeComponent() at SomeMainDialog..ctor()} The element declaration where this happens looks like this (the event handler referenced here is defined, of course): <l

Silverlight combobox number of items shown refresh

回眸只為那壹抹淺笑 提交于 2019-12-01 13:25:22
I have two combo boxes on a SL page. When Combo 1 updates, a service is called and populates Combo 2. On the first call, 3 results are returned. When the combo box is expanded, you can see all 3 options. On the second call, 4 results are returned. When the combo box is expanded, you can see 3 options, with a vertical scroll bar. If I reload and do those steps in reverse, I get 4 rows the first call and 3 rows + a blank row on the second call. (No, the blank is not a record. It cannot be selected.) It appears that the drop down list size keeps the first generated height. How can I refresh the

XamlParseException: Attribute in custom control missing, but it's defined!

心已入冬 提交于 2019-12-01 12:29:39
问题 I sometimes get the following exception for a custom control of mine: XamlParseException occurred Unknown attribute Points in element SectionClickableArea [Line: 10 Position 16] The stack trace: {System.Windows.Markup.XamlParseException: Unknown attribute Points on element SectionClickableArea. [Line: 10 Position: 16] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at SomeMainDialog.InitializeComponent() at SomeMainDialog..ctor()} The element declaration

Custom Rendering in Bing Silverlight Control

橙三吉。 提交于 2019-12-01 11:25:37
I'm ramping up on a Silverlight 2 project that leverages the Bing Maps control. One thing our UX guys are wondering is whether it is possible to customize the look of the map completely. For example, draw countries as simple outlines with different color interiors. Or draw the ocean as white and countries as black dotted shapes. Does anyone know whether it is possible to achieve this level of customization? The MapMode class looked promising, but it doesn't seem to quite give me what I need. Thanks, Kent Kent Boogaart To answer my own question, yes this is possible. Firstly, add your own layer

Is there a notification mechanism for when a dependency property has changed?

拈花ヽ惹草 提交于 2019-12-01 11:14:35
In a Silverlight application I'm trying to find out when a property on a usercontrol has changed. I'm interested in one particular DependencyProperty, but unfortunately the control itself doesn't implement INotifyPropertyChanged. Is there any other way of determining if the value has changed? In WPF you have DependencyPropertyDescriptor.AddValueChanged , but unfortunately in Silverlight there's no such thing. So the answer is no. Maybe if you explain what are you trying to do you can workaround the situation, or use bindings. You can. Atleast I did. Still need to see the pros and Cons. ///