silverlight-3.0

How to define a DataTemplate in code?

无人久伴 提交于 2019-12-03 23:38:36
How can I create a DataTemplate in code (using C#) and then add a control to that DataTemplate ? <data:DataGrid.RowDetailsTemplate> <DataTemplate> <Border> <Border Margin="10" Padding="10" BorderBrush="SteelBlue" BorderThickness="3" CornerRadius="5"> <TextBlock Text="{Binding Description}" TextWrapping="Wrap" FontSize="10"> </TextBlock> </Border> </Border> </DataTemplate> </data:DataGrid.RowDetailsTemplate> I am using Sivlerlight. Josh As far as I know, the only way to create a DataTemplate in Silverlight is to use XamlReader . Basically you would just pass it the XAML as a string and it will

Attaching an Event Handler to a Code Generated DataTemplate

心已入冬 提交于 2019-12-03 17:24:40
I have a question related to this one : I'm trying to attach an event to my StackPanel but it doesn't appear to connect when using the XamlReader. I can't get the ChildItem_Load method to get called. Does anyone know of a way to do this? Other than this event the code works fine. this._listBox.ItemTemplate = (DataTemplate) XamlReader.Load( @"<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""> <Border> <StackPanel Loaded=""ChildItem_Loaded""> <TextBlock Text=""{Binding " + this._displayMemberPath + @"}"" /> </StackPanel> </Border> </DataTemplate>" Ok, I figured

Convert address to coordinates

元气小坏坏 提交于 2019-12-03 17:15:41
There is a way to convert address to coordinates with bing maps? Thank The process of going from addresses to lat/lng coordinates is normally called Geocoding This blog post has some good example code for WP7 using Bing - http://www.braincastexception.com/wp7-web-services-first-part-geocodeservice/ You can use Locations API . 来源: https://stackoverflow.com/questions/5529135/convert-address-to-coordinates

Silverlight local storage

…衆ロ難τιáo~ 提交于 2019-12-03 16:34:23
As you may know Silverlight has support for local storage. We are looking at creating Sl application that will work in off line mode. This application may require quite a bit of data to be cached on the client side. Obvious solution - use local storage with some sort of XMl based structure won't work as our PoC showed due to performance issues. We are looking at several 3rd party solutions that implement light database engines on top of SL local storage. If you have solved this problem in the past or have any ideas - I would appreciate some pointers and ideas. This is a client side object

Can I add dll to Silverlight 3 application?

倖福魔咒の 提交于 2019-12-03 15:06:32
I am tring to add dll file to my Silverlight application but get error which says that I can't add reference which wasn't built with Silverlight runtime. Is there any solution? Thanks. Try to use WCF Service to connect to your DLL.I did that way and it solved my problem. Try creating an empty Silverlight class library, then add all your code to that project, then you will be able to add it to a silverlight application as a reference. If this does not meet your needs, upgrade to Silverlight 4, you should be able to add libraries to your project with no problems, but the library will still run

How to use Canvas as the ItemsPanel for an ItemsControl in Silverlight 3

早过忘川 提交于 2019-12-03 13:17:17
问题 I am trying to set the Canvas properties in an ItemsControl DataTemplate with Silverlight 3. According to this post, the only way of doing that is to set it using the ItemsContainerStyle for the ContentPresenter type, since the Canvas properties only take effect on direct children of the Canvas. This doesn't seem to work in SL3, since the ItemsControl doesn't have an ItemsContainerStyle property, so I tried a ListBox as advised by this article, but it still doesn't work. From the XAML below,

Does Silverlight 3 Change the MVC vs. Silverlight question?

社会主义新天地 提交于 2019-12-03 12:47:12
I'm starting a new project soon and investigating whether or not to use MVC, Silverlight or both. This question Silverlight vs. ASP.NET MVC was a good starting point. But looking over the SL3 beta, it looks like there are two things that change the landscape just a bit. First, the navigation feature which is a direct feature of Silverlight and now there is the .NET RIA Services. While not actually part of Silverlight, it's fairly integrated and seems to bridge the gap between client and server operations. An area, in my opinion where MVC is strong and Silverlight (being a client side

Using MergedDictionaries in generic.xaml in Silverlight 3

穿精又带淫゛_ 提交于 2019-12-03 12:31:44
In WPF it was possible to organise the XAML for multiple user controls by keeping the markup in separate XAML files in the themes folder and then using MergedDictionaries to import them into generic.xaml: <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="MyFirstControl.xaml" /> <ResourceDictionary Source="MySecondControl.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> With the availability of the Silverlight 3 beta introducing merged dictionary support, it seemed like it might be possible to do the same with Silverlight user

Error when binding a Dependency Property on a custom Behavior

女生的网名这么多〃 提交于 2019-12-03 12:08:40
I am exploring the Silverlight attached behaviors mechanism in order to use the Model-View-ViewModel pattern within my Silverlight applications. To start with, I am trying to get a simple Hello World working, but I am completely stuck in an error for which I'm not able to find a solution. What I have right now is a page that just contains a button which should display a message when clicked. The click event is handled by using a class derived from Behavior, and the message is specified as a dependency property of the behavior itself. The problem comes when trying to bind the message property

Silverlight Bind to inverse of boolean property value

蓝咒 提交于 2019-12-03 06:03:21
I want to bind a controls visibility to inverse of boolean property value. I have a property CanDownload, if it is true then I want to hide textbox and vice versa. How can I achieve this? Thanks This sort of question is asked so often and the answers so similar I thought its time to have a single answer to all (ok may "most") of the bool to value conversion questions. I've blogged it here . The code is quite simple so I'll paste it here too:- public class BoolToValueConverter<T> : IValueConverter { public T FalseValue { get; set; } public T TrueValue { get; set; } public object Convert(object