Search Results

Search found 6043 results on 242 pages for 'silverlight 3 0'.

Page 8/242 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • SilverLight 3 Beginner question: Scroll with mousewheel and zoom image with panning

    - by JP Hellemons
    Hello, I would like to make a small silverlight app which displays one fairly large image which can be zoomed in by scrolling the mouse and then panned with the mouse. it's similar to the function in google maps and i do not want to use deepzoom. here is what i have at the moment. please keep in mind that this is my first silverlight app: this app is just for me to see it's a good way to build in a website. so it's a demo app and therefor has bad variable names. the initial image is 1800px width. private void sc_MouseWheel(object sender, MouseWheelEventArgs e) { var st = (ScaleTransform)plaatje.RenderTransform; double zoom = e.Delta > 0 ? .1 : -.1; st.ScaleX += zoom; st.ScaleY += zoom; } this works, but could use some smoothing and it's positioned top left and not centered. the panning is like this: found it @ http://stackoverflow.com/questions/741956/wpf-pan-zoom-image and converted it to this below to work in silverlight Point start; Point origin; bool captured = false; private void plaatje_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { plaatje.CaptureMouse(); captured = true; var tt = (TranslateTransform)((TransformGroup)plaatje.RenderTransform) .Children.First(tr => tr is TranslateTransform); start = e.GetPosition(canvasje); origin = new Point(tt.X, tt.Y); } private void plaatje_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { plaatje.ReleaseMouseCapture(); captured = false; } private void plaatje_MouseMove(object sender, MouseEventArgs e) { if (!captured) return; var tt = (TranslateTransform)((TransformGroup)plaatje.RenderTransform).Children.First(tr => tr is TranslateTransform); double xVerschuiving = start.X - e.GetPosition(canvasje).X; double yVerschuiving = start.Y - e.GetPosition(canvasje).Y; tt.X = origin.X - xVerschuiving; tt.Y = origin.Y - yVerschuiving; } so the scaling isn't smooth and the panning isn't working, because when i click it, the image disappears. thanks in advanced!

    Read the article

  • Capture Silverlight 4 event when panel clicked

    - by Eric J.
    I have a small Silverlight 4 app that essentially consists of a grid containing a label and a combo box. When I click the label, I replace it with a second text box so that I can edit the label (much the way you can edit the name of a Silverlight control in VS2010). I have a LostFocus event handler on the text box that will end editing when the control loses focus (restoring the updated label). Trouble is, users tend to click on the panel when they are done editing rather than on another control (or hitting Enter, which is also supported). I tried adding a left mouse down event handler to the panel. However, that only fires when the text box does not have the focus (I guess the text box captured the mouse?) Is there an approach to recognize that a non-input control was clicked that would enable me to terminate edit mode?

    Read the article

  • Setting the colour scheme for a Silverlight app from an external resource

    - by Alex Angas
    I have a Silverlight 3 application containing six custom user controls. I'd like to load the colour scheme for these controls from an external resource. The code and XAML containing a default colour scheme would be built in the XAP. Then a parameter on the object tag would contain a URL from where alternate colours can be dynamically loaded. By the way, the Silverlight 3 application theme feature could be used if that's possible but is really overkill. Only colours need to be changed. Is this possible and how would you recommend to do it?

    Read the article

  • Scope of the Pages in a Silverlight application

    - by AngryHacker
    I have an app built with the Silverlight Navigation Application Template. I have a main form (e.g. MainPage.xaml) and a bunch of Silverlight Pages, which are swapped in and out of the main content area. In the MainPage.xaml, I have a DispatcherTimer which hits some Uri resources, regardless of which page I am on. Every now and then, it will inexplicably stop firing. I have an inkling that it has to do with the scope of various pages. Can pages inside the MainPage.xaml take away the scope from its parent? Or is this something much simpler?

    Read the article

  • Silverlight As Transmedia Platform Silverlight TV

    I’m very excited to say that my discussion with John Papa about Silverlight as a Transmedia Storytelling Platform is live....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Using initParams in Silverlight 4 project

    - by Silverlight Beginner
    I'm trying to upgrade a project that uses Silverlight 2 to use Silverlight 4 but I have problem with initparam to set domain. The old Silverlight 2 project: <form id="form1" runat="server" style="height:100%;"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div style="height:100%;"> <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/EKAKC.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" /> </div> </form> And from Default.aspx.cs: Xaml1.InitParameters += "Domain=" + domain; The new Silverlight 4 project: <body style="height: 100%; margin: 0;"> <form id="form1" runat="server" style="height: 100%;"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div id="silverlightControlHost"> <object type="application/x-silverlight-2" data="data:application/x-silverlight," width="300" height="300"> <param name="source" value="EKAKC.xap"/> <param name="initParams" value="<%= string.Format("WCFReferenceURL={0}", ConfigurationManager.AppSettings["WCFReferenceURL"])%>" /> </object> </div> The Domain will not be set in my new Silverlight 4 project

    Read the article

  • using Silverlight 3's HtmlPage.Window.Navigate method to reuse an already open browser window

    - by Phil
    Hi, I want to use an external browser window to implement a preview functionality in a silverlight application. There is a list of items and whenever the user clicks one of these items, it's opened in a separate browser window (the content is a pdf document, which is why it is handled ouside of the SL app). Now, to achieve this, I simply use HtmlPage.Window.Navigate(new Uri("http://www.bing.com")); which works fine. Now my client doesn't like the fact that every click opens up a new browser window. He would like to see the browser window reused every time an item is clicked. So I went out and tried implementing this: Option 1 - Use the overload of the Navigate method, like so: HtmlPage.Window.Navigate(new Uri("http://www.bing.com"), "foo"); I was assuming that the window would be reused when the same target parameter value (foo) would be used in subsequent calls. This does not work. I get a new window every time. Option 2 - Use the PopupWindow method on the HtmlPage HtmlPage.PopupWindow(new Uri("http://www.bing.com"), "blah", new HtmlPopupWindowOptions()); This does not work. I get a new window every time. Option 3 - Get a handle to the opened window and reuse that in subsequent calls private HtmlWindow window; private void navigationButton_Click(object sender, RoutedEventArgs e) { if (window == null) window = HtmlPage.Window.Navigate(new Uri("http://www.bing.com"), "blah"); else window.Navigate(new Uri("http://www.bing.com"), "blah"); if (window == null) MessageBox.Show("it's null"); } This does not work. I tried the same for the PopupWindow() method and the window is null every time, so a new window is opened on every click. I have checked both the EnableHtmlAccess and the IsPopupWindowAllowed properties, and they return true, as they should. Option 4 - Use Eval method to execute some custom javascript private const string javascript = @"var popup = window.open('', 'blah') ; if(popup.location != 'http://www.bing.com' ){ popup.location = 'http://www.bing.com'; } popup.focus();"; private void navigationButton_Click(object sender, RoutedEventArgs e) { HtmlPage.Window.Eval(javascript); } This does not work. I get a new window every time. option 5 - Use CreateInstance to run some custom javascript on the page private void navigationButton_Click(object sender, RoutedEventArgs e) { HtmlPage.Window.CreateInstance("thisIsPlainHell"); } and in my aspx I have function thisIsPlainHell() { var popup = window.open('http://www.bing.com', 'blah'); popup.focus(); } Guess what? This does work. The only thing is that the window behaves a little strange and I'm not sure why: I'm behind a proxy and in all other scenarios I'm being prompted for my password. In this case however I am not (and am thus not able to reach the external site - bing in this case). This is not really a huge issue atm, but I just don't understand what's goign on here. Whenever I type another url in the address bar of the popup window (eg www.google.com) and press enter, it opens up another window and prompts me for my proxy password. As a temporary solution option 5 could do, but I don't like the fact that Silverlight is not able to manage this. One of the main reasons my client has opted for Silverlight is to be protected against all the browser specific hacking that comes with javascript. Am I doing something wrong? I'm definitely no javascript expert, so I'm hoping it's something obvious I'm missing here. Cheers, Phil

    Read the article

  • Custom UserControl property not being set via XAML DataBinding in Silverlight 4

    - by programatique
    I have a custom user control called GoalProgressControl. Another user control contains GoalProgressControl and sets its GoalName attribute via databinding in XAML. However, the GoalName property is never set. When I check it in debug mode GoalName remains "null" for the control's lifetime. How do I set the GoalName property? Is there something I am doing incorrectly? I am using .NET Framework 4 and Silverlight 4. I am relatively new to XAML and Silverlight so any help would be greatly appreciated. I have attempted to change GoalProgressControl.GoalName into a POCO property but this causes a Silverlight error, and my reading leads me to believe that databound properties should be of type DependencyProperty. I've also simplified my code to just focus on the GoalName property (the code is below) with no success. Here is GoalProgressControl.xaml: <UserControl x:Class="GoalView.GoalProgressControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding RelativeSource={RelativeSource Self}}" Height="100"> <Border Margin="5" Padding="5" BorderBrush="#999" BorderThickness="1"> <TextBlock Text="{Binding GoalName}"/> </Border> </UserControl> GoalProgressControl.xaml.cs: public partial class GoalProgressControl : UserControl, INotifyPropertyChanged { public GoalProgressControl() { InitializeComponent(); } public event PropertyChangedEventHandler PropertyChanged; public void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public static DependencyProperty GoalNameProperty = DependencyProperty.Register("GoalName", typeof(string), typeof(GoalProgressControl), null); public string GoalName { get { return (String)GetValue(GoalProgressControl.GoalNameProperty); } set { base.SetValue(GoalProgressControl.GoalNameProperty, value); NotifyPropertyChanged("GoalName"); } } } I've placed GoalProgressControl on another page: <Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="5" Background="#eee" Height="200"> <Border BorderBrush="#999" BorderThickness="1" Background="White"> <StackPanel> <hgc:SectionTitleBar x:Name="ttlGoals" Title="Personal Goals" ImageSource="../Images/check.png" Uri="/Pages/GoalPage.xaml" MoreVisibility="Visible" /> <ItemsControl ItemsSource="{Binding Path=GoalItems}"> <ItemsControl.ItemTemplate> <DataTemplate> <!--TextBlock Text="{Binding Path=[Name]}"/--> <goal:GoalProgressControl GoalName="{Binding Path=[Name]}"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </StackPanel> </Border> </Grid> Please note the commented out "TextBlock" item above. If I comment in the TextBlock and comment out the GoalProgressControl, the binding works correctly and the TextBlock shows the GoalName correctly. Also, if I replace the "GoalName" property above with a simple text string (ex "hello world"), the control renders correctly and "hello world" is shown on the control when it renders.

    Read the article

  • AreaDataPoint in SL3 Chart is Fixed Size

    - by Wonko the Sane
    In Silverlight 3, it appears that the AreaDataPoint template ignores any size set in its ControlTemplate. <ControlTemplate TargetType="chartingTK:AreaDataPoint"> <Grid x:Name="Root" Opacity="1"> <!-- Width and Height are ignored --> <Ellipse Width="75" Height="25" StrokeThickness="{TemplateBinding BorderThickness}" Stroke="OrangeRed" Fill="{TemplateBinding Background}"/> </Grid> </ControlTemplate> Does anybody know of a workaround?

    Read the article

  • COM Object Method Invoke Exception - Silverlight 4

    - by Adam Driscoll
    I'm trying to use the new AutomationFactory provided with Silverlight 4 to call a .NET COM class. .NET COM-Exposed Class: public class ObjectContainer { public bool GetObject([Out, MarshalAs((UnmanagedType.IUnknown)] out object obj) { obj = new SomeOtherObj(); return true; } } Silverlight Assembly: dynamic objectContainer; try { objectContainer = AutomationFactory.GetObject(ProgId); } catch { objectContainer = AutomationFactory.CreateObject(ProgId); } object obj; if (!objectContainer.GetObject(out obj)) { throw new Exception(); } When I call objectContainer.GetObject(out obj) an exception is thrown stating: Value does not fall within the expected range. at MS.Internal.ComAutomation.ComAutomationNative.CheckInvokeHResult(UInt32 hr, String memberName, String exceptionSource, String exceptionDescription, String exceptionHelpFile, UInt32 exceptionHelpContext) at MS.Internal.ComAutomation.ComAutomationNative.Invoke(Boolean tryInvoke, String memberName, ComAutomationInvokeType invokeType, ComAutomationInteropValue[] rgParams, IntPtr nativePeer, ComAutomationInteropValue& returnValue) at MS.Internal.ComAutomation.ComAutomationObject.InvokeImpl(Boolean tryInvoke, String name, ComAutomationInvokeType invokeType, Object& returnValue, Object[] args) at MS.Internal.ComAutomation.ComAutomationObject.Invoke(String name, ComAutomationInvokeType invokeType, Object[] args) at System.Runtime.InteropServices.Automation.AutomationMetaObjectProvider.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result) at System.Runtime.InteropServices.Automation.AutomationMetaObjectProviderBase.<.cctorb__4(Object obj, InvokeMemberBinder binder, Object[] args) at CallSite.Target(Closure , CallSite , Object , String , Object& ) at CallSite.Target(Closure , CallSite , Object , String , Object& ) at ApplicationModule.ObjectContainer.GetObject() Wha's the deal?

    Read the article

  • Silverlight ScriptableMember in Firefox 'Content is undefined' error.

    - by Sergey Mirvoda
    Recently I'm learned how to call SIlverlight methods from JavaScript. All works fine (even in Chrome !). But in FireFox 3 (3.6.4) registered Page object is undefined. My Code is very simple silverlight [ScriptableMember] public bool HasFilter() { return true; } And in MainPage constructor public MainPage() { InitializeComponent(); HtmlPage.RegisterScriptableObject("Page",this); LayoutRoot.DataContext = viewModel; Loaded += OnLoaded; } JavaScript <head> <script type="text/javascript"> function UpdateFilter() { var sl = document.getElementById('SilverlightChartControl'); alert(sl); alert(sl.Content.Page.HasFilter()); } </script> </head> <body> <a href="#" id="resize" onclick="UpdateFilter(); return false;">TEST</a> </body>

    Read the article

  • Silverlight 4 WriteableBitmap ScaleTransform Exception but was working in v3

    - by Imran
    I am getting the following exception for code that used to work in silverlight 3 but has stopped working since upgrading to silverlight 4: System.AccessViolationException was unhandled Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. namespace SilverlightApplication1 { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { var OpenFileDialog = new OpenFileDialog(); OpenFileDialog.Filter = "*.jpg|*.jpg"; if (OpenFileDialog.ShowDialog() == true) { var file = OpenFileDialog.Files.ToArray()[0]; ScaleStreamAsBitmap(file.OpenRead(), 200); } } public static WriteableBitmap ScaleStreamAsBitmap(Stream file, int maxEdgeLength) { file.Position = 0; var src = new BitmapImage(); var uiElement = new System.Windows.Controls.Image(); WriteableBitmap b = null; var t = new ScaleTransform(); src.SetSource(file); uiElement.Source = src; //force render uiElement.Effect = new DropShadowEffect() { ShadowDepth = 0, BlurRadius = 0 }; ; //calc scale double scaleX = 1; double scaleY = 1; if (src.PixelWidth > maxEdgeLength) scaleX = ((double)maxEdgeLength) / src.PixelWidth; if (src.PixelHeight > maxEdgeLength) scaleY = ((double)maxEdgeLength) / src.PixelHeight; double scale = Math.Min(scaleX, scaleY); t.ScaleX = scale; t.ScaleY = scale; b = new WriteableBitmap(uiElement, t); return b; } } } Thanks

    Read the article

  • Silverlight 2 Error Code: 4004

    - by jkidv
    Hey guys/gals. I have a silverlight 2 app that has an ObservableCollection of a class from a separate assem/lib. When I set my ListBox.ItemsSource on that collection, and run it, I get the error code: 4004 "System.ArgumentException: Value does not fall within the expected range." Here is part of the code: public partial class Page : UserControl { ObservableCollection<Some.Lib.Owner> ooc; public Page() { ooc = new ObservableCollection<Some.Lib.Owner>(); Some.Lib.Owner o1 = new Some.Lib.Owner() { FirstName = "test1" }; Some.Lib.Owner o2 = new Some.Lib.Owner() { FirstName = "test2" }; Some.Lib.Owner o3 = new Some.Lib.Owner() { FirstName = "test3" }; ooc.Add(o1); ooc.Add(o2); ooc.Add(o3); InitializeComponent(); lb1.ItemsSource = ooc; } } But when I create the Owner class within this same project, everything works fine. Is there some security things going on behind the scenes? Also, I'm using the generate a html page option and not the aspx option, when I created this Silverlight 2 app.

    Read the article

  • Silverlight: Problem using CellEditingTemplate

    - by Charles
    Hello Silverlight gurus, I am experiencing a problem with the DataGrid where my data-bound object's properties are not being updated when using the CellTemplate/CellEditingTemplate: <data:DataGridTemplateColumn Header="Text"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Text}" ></TextBlock> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> <data:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text="{Binding Text, Mode=TwoWay}" /> </DataTemplate> </data:DataGridTemplateColumn.CellEditingTemplate> </data:DataGridTemplateColumn> I am binding to a code-gen'd entity via the RIA Services. I've added an event handler to the PropertyChanged event, and it is never fired. However, if I do not use a template and instead use a DataGridTextColumn, everything works fine. I'm sure this sounds like an easy fix - I'm only using a TextBox in my editing template, so why not us a DataGridTextColumn? The problem is that I want to have a multi-line textbox, so using the DataGridTextColumn is not an option. Any suggestions? Do you know of any differences between using a CellEditingTemplate containing a single TextBox and using a DataGridTextColumn? Thanks, -Charles [UPDATE] I posted a bug report here: http://silverlight.net/forums/p/118729/267521.aspx I can't imagine that this is "as-designed"... If someone else has known about this and I'm just being dumb, I'd appreciate an explanation - I'd prefer embarrassment over ignorance :).

    Read the article

  • Starting out Silverlight 4 design

    - by Fermin
    I come from mainly a web development background (ASP.NET, ASP.NET MVC, XHTML, CSS etc) but have been tasked with creating/designing a Silverlight application. The application is utilising Bing Maps control for Silverlight, this will be contained in a user control and will be the 'main' screen in the system. There will be numerous other user controls on the form that will be used to choose/filter/sort/order the data on the map. I think of it like Visual Studio: the Bing Maps will be like the code editor window and the other controls will be like Solutions Explorer, Find Results etc. (although a lot less of them!) I have read up and I'm comfortable with the data side (RIA-Services) of the application. I've (kinda) got my head around databinding and using a view model to present data and keep the code behind file lite. What I do need some help on is UI design/navigation framework, specifically 2 aspects: How do I best implement a fluid design so that the various user controls which filter the map data can be resized/pinned/unpinned (for example, like the Solution Explorer in VS)? I made a test using a Grid with a GridSplitter control, is this the best way? Would it be best to create a Grid/Gridsplitter with Navigation Frames inside the grid to load the content? Since I have multiple user controls that basically use the same set of data, should I set the dataContext at the highest possible level (e.g. if using a grid with multiple frames, at the Grid level?). Any help, tips, links etc. will be very much appreciated!

    Read the article

  • Trigger for ComboBox in Silverlight

    - by Budda
    Is there any possibility to display selected item of the ComboBox (after popup closing) in a way that is different from its displaying in DropDown List (There are players number and name in the dropdown list, but after list closing I want to see only its number). How can I change a background for the player with some Flag? As far as I know, all of that can be done with triggers, but are they supported in Silverlight 4, VS2010, Silverlight Toolkit 4? In my case the following code <ComboBox ItemsSource="{Binding PlayersAll}" SelectedItem="{Binding Path=SelectedPlayer, Mode=TwoWay}" > <ComboBox.ItemTemplate> <DataTemplate> <ToolkitControls:WrapPanel Orientation="Horizontal"> <TextBlock Text="{Binding TeamNumber}"/> <TextBlock Text=" - "/> <TextBlock Text="{Binding ShortName}"/> </ToolkitControls:WrapPanel> <DataTemplate.Triggers> <Trigger Property="HasError" Value="True"> <Setter Property="Background" TargetName="FlagSet" Value="Red"/> </Trigger> </DataTemplate.Triggers> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> gives an error: The property 'Triggers' does not exist on the type 'DataTemplate' in the XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation' what is wrong here? Here are my namespaces: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" xmlns:ToolkitControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"

    Read the article

  • PRISM - Creating mouseoverbehavior causes a Silverlight library to not be visible in main Silverligh

    - by RHLopez
    Created a simple Silverlight 4 application (SimpleApp) then added a Silverlight 4 library (LibraryA). Added code to the library (LibraryA) to implement MouseOverBehavior by inheriting from CommandBaseBehavior along with the appropriate attached property class/methods. Added reference in SimpleApp to LibraryA and went to MainPage.xaml to add namespace reference but it does not show up with Intellisense. Typing the namespace manually and then adding the attached MouseOver command works as it should as far as intellisense showing my attached property name, i.e. ... commands:MouseOver.Command="{Binding MousedOver}". However when I try to run it I get a XAML parser error saying that the "Command" attached property does not exist in MouseOver. If I move my class definitions from LibraryA to SimpleApp then everything works. I removed everything from LibraryA and just put one class with this in it: public class MouseOverBehavior : CommandBehaviorBase<Control> { public MouseOverBehavior(Control element) : base(element) {} } With this simple class in LibraryA it will not show up in XAML intellisense in SimpleApp. XAML intellisense works with other libraries that I have written that don't use PRISM. Don't know what I am missing hopefully it's something simple. I am using the latest SL4 build for PRISM change set 42969. Visual Studio 2010 RTM Professional in Windows 7 Ultimate 64-bit.

    Read the article

  • Issue intercepting property in Silverlight application

    - by joblot
    I am using Ninject as DI container in a Silverlight application. Now I am extending the application to support interception and started integrating DynamicProxy2 extension for Ninject. I am trying to intercept call to properties on a ViewModel and ending up getting following exception: “Attempt to access the method failed: System.Reflection.Emit.DynamicMethod..ctor(System.String, System.Type, System.Type[], System.Reflection.Module, Boolean)” This exception is thrown when invocation.Proceed() method is called. I tried two implementations of the interceptor and they both fail public class NotifyPropertyChangedInterceptor: SimpleInterceptor { protected override void AfterInvoke(IInvocation invocation) { var model = (IAutoNotifyPropertyChanged)invocation.Request.Proxy; model.OnPropertyChanged(invocation.Request.Method.Name.Substring("set_".Length)); } } public class NotifyPropertyChangedInterceptor: IInterceptor { public void Intercept(IInvocation invocation) { invocation.Proceed(); var model = (IAutoNotifyPropertyChanged)invocation.Request.Proxy; model.OnPropertyChanged(invocation.Request.Method.Name.Substring("set_".Length)); } } I want to call OnPropertyChanged method on the ViewModel when property value is set. I am using Attribute based interception. [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class NotifyPropertyChangedAttribute : InterceptAttribute { public override IInterceptor CreateInterceptor(IProxyRequest request) { if(request.Method.Name.StartsWith("set_")) return request.Context.Kernel.Get<NotifyPropertyChangedInterceptor>(); return null; } } I tested the implementation with a Console Application and it works alright. I also noted in Console Application as long as I had Ninject.Extensions.Interception.DynamicProxy2.dll in same folder as Ninject.dll I did not have to explicitly load DynamicProxy2Module into the Kernel, where as I had to explicitly load it for Silverlight application as follows: IKernel kernel = new StandardKernel(new DIModules(), new DynamicProxy2Module()); Could someone please help? Thanks

    Read the article

  • Dynamically add User Controls to a Silverlight 4 page

    - by PilotBob
    I am building an iGoogle like "dashboard" for our application with silverlight 4. Each users dashboard (which snapins and their positions) will be stored in the database. Each snap in is a user control, for example... AwesomeSnapin.xaml. On the dashboard page in silverlight I am retrieving the users dashboard which is a collection of snapin objects which include the information on the snapin. I can store the name of the page or the class or whatever is needed. I have the following code which loops through the collection of snapins to add them to the dashboard page. In testing I have just hard coded a single snapin item. Here is the prototype code: foreach (var UserSnapin in op.Entities) { UserControl uc = new AmsiSL.eFinancials.BudgetCheck(); Canvas.SetLeft(uc, UserSnapin.PositionLeft); Canvas.SetTop(uc, UserSnapin.PositionTop); Layout.Children.Add(uc); MessageBox.Show(String.Format("Added {0}",UserSnapin.Snapin.Name)); } The above works fine... but of course adds the BudgetCheck snapin for every item that is defined for the users dashboard. Of course the messagebox is for debugging purposes only. How would I change line 3 of that to load the user control class (using classname or xaml path whichever is better) based on the data in the collection.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >