DCSIMG
Dynamic,C# - Alex Golesh's Blog About Silverlight Development

Browse by Tags

All Tags » Dynamic » C# (RSS)

PDC09 Day 1 – Dynamics in C# 4

Switched to the Dynamics in C# 4 session. This session hall is not full at all… I’d rather say it is pretty empty… Probably this session is for real technology geeks like me :)   Did you know, that you cold create your own dynamic object by deriving from DynamicObject base class? class Program { static void Main( string [] args) { dynamic d = new myDynamic (); Console .WriteLine(d++); } } class myDynamic : DynamicObject { public override bool TryUnaryOperation( UnaryOperationBinder binder, out...

Silverlight Quick Tip: Dynamically Updating Class Fields/Properties

In previous post ( here ) I blogged about displaying values of class/control in runtime and displaying them in Visual Studio - like property window. Today I’ll show how to push them back to the class instance. In previous post I’ve stored values in “ObservableCollection<FieldsPropertiesData>” for easy databinding and connected this ListBox control. In order to get user input I’ve created TwoWay databinding in DataTemplate – here is updated data template: < Style TargetType ="local:FiledPropertyData">...

Silverlight Quick Tip: Dynamically Displaying Class Fields/Properties

In one of my projects I had to create something like Visual Studio property window, for data set of different controls/data classes. Those controls/classes are still under development and I needed the way to display/change values of those properties dynamically without even knowing what is inside. For the simple case, let’s assume the following class which holds the data: public class SampleData { public SampleData() { BooleanProperty = false ; } public string StringProperty { get ; set ; } public...

Silverlight Tip: Dynamic animations

Hello, I was asked about creation of animations dynamically for various elements. Today I’ll show how to create such animations for any (almost) Silverlight element. I’ll create some of popular standard PowerPoint animations. I know that it is not the full set of animations available in PowerPoint, also the animations itself are probably not perfect but it is a good starting point to those who want to know how to do it. Generally, to create the animation on-the-fly we need to create a storyboard...

Silverlight Tip: How to Inject and Execute JavaScript Function(s) on-the-fly from Silverlight

Today I’ve been asked by colleague how to inject and execute JavaScript functionality from Silverlight application to the HTML DOM of hosting page. Well, things are pretty easy. First we need to get JavaScript from somewhere. In colleague's case it was an embedded resource, in my sample I’ll use TextBox to accept the script code. Also I’ll accept function name and parameters from UI. From here we have two approaches: to Eval the function code or to create “Script” element dynamically. First approach...

Quick Silverlight Tip: Define control style dynamically

Lately I've been asked a couple of time by client how to provide certain level of customization for their Silverlight application. In many cases they want to provide their client with ability to change styles/templates in application or part of it. Another common request, is to provide an ability to use external style definitions. Here the quick tip on how it could be achieved. I'll build really simple solution, which uses WebService to provide external style definition as loose XAML file...

Quick Silverlight Tip: Creating/Destroying Silverlight 2 Object dynamically

One of my clients asked me how to create and show (and then destroy) Silverlight application on the fly. Here is very fast solution, which allows such an object to be created and destroyed. First, we (still) need to have some DIV which will hold the object. Here is my sample page HTML: 1: < body > 2: <!-- Runtime errors from Silverlight will be displayed here. 3: This will contain debugging information and should be removed or hidden when debugging is completed --> 4: < div id ='errorLocation'...