Toolbar source

ToolBar.xaml

<Canvas xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Width="640" 
        Height="480" /> 

Toolbar.xaml.cs

using System; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Ink; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using System.Collections.ObjectModel; 

namespace SPFControls 
{ 
    public class Toolbar : Control 
    { 
        Canvas _rootCanvas; 
        ObservableCollection<ToolbarButton> _toobarcollection; 

        public Toolbar() 
        { 
            System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("Toolbar.Toolbar.xaml"); 
            _rootCanvas = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd()) as Canvas; 
            _toobarcollection = new ObservableCollection<ToolbarButton>(); 
            _toobarcollection.CollectionChanged += new NotifyCollectionChangedEventHandler<ToolbarButton>(_toobarcollection_CollectionChanged); 
            this.Loaded += new EventHandler(Toolbar_Loaded); 
        } 

        void _toobarcollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs<ToolbarButton> e) 
        { 
            UpdateLayout(); 
        } 

        public ObservableCollection<ToolbarButton> ToolBarCollection 
        { 
            get { return _toobarcollection; } 
        } 

        void Toolbar_Loaded(object sender, EventArgs e) 
        { 
            UpdateLayout(); 
        } 

        public new double Height 
        { 
            get { return ((FrameworkElement)this).Height; } 
            set 
            { 
                ((FrameworkElement)this).Height = value; 
                UpdateLayout(); 
            } 
        } 

        public new double Width 
        { 
            get { return ((FrameworkElement)this).Width; } 
            set 
            { 
                ((FrameworkElement)this).Width = value; 
                UpdateLayout(); 
            } 
        } 

        void UpdateLayout() 
        { 
            double buttonwidth = 1; 
            double left = 0; 
            try 
            { 
                _rootCanvas.Height = Height; 
                _rootCanvas.Width = Width; 
                if (_toobarcollection.Count > 0) 
                { 
                    buttonwidth = Width / _toobarcollection.Count; 
                } 

                _rootCanvas.Children.Clear(); 
                foreach (ToolbarButton tb in _toobarcollection) 
                { 
                    tb.Height = Height; 
                    tb.Width = buttonwidth; 
                    _rootCanvas.Children.Add(tb); 
                    tb.SetValue(Canvas.LeftProperty, left); 
                    left += buttonwidth; 
                } 

            } 
            catch (Exception err) 
            { 
            } 

        } 

    } 
} 

ToolbarButton.xaml

<Canvas xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Width="70" 
        Height="70" 
        MouseEnter="_rootCanvas_MouseEnter" 
        > 
<Canvas.Resources> 

                <Storyboard x:Name="Popup"> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="2"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="2"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="2"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="2"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/> 
                    </DoubleAnimationUsingKeyFrames> 
                </Storyboard> 
                <Storyboard x:Name="PopDown"> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="2"/> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="2"/> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="2"/> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="2"/> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Opacity)"> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> 
                        <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.7"/> 
                    </DoubleAnimationUsingKeyFrames> 
                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.OpacityMask).(SolidColorBrush.Color)"> 
                        <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/> 
                        <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFEFF4FA"/> 
                    </ColorAnimationUsingKeyFrames> 
                </Storyboard> 

    </Canvas.Resources> 
    <Rectangle RenderTransformOrigin="0.5,0.5" Stroke="#FF000000" RadiusX="14.5" RadiusY="14.5" x:Name="rectangle" Width="70" Height="70" StrokeThickness="1"> 
        <Rectangle.Fill> 
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" x:Name="UnPressed"> 
                <GradientStop Color="#FF6392C7" Offset="0"/> 
                <GradientStop Color="#FF6392C7" Offset="1"/> 
                <GradientStop Color="#FFF8F2F2" Offset="0.12"/> 
                <GradientStop Color="#FFF8F2F2" Offset="0.899"/> 
            </LinearGradientBrush> 
        </Rectangle.Fill> 
        <Rectangle.RenderTransform> 
            <TransformGroup> 
                <ScaleTransform ScaleX="1" ScaleY="1"/> 
                <SkewTransform AngleX="0" AngleY="0"/> 
                <RotateTransform Angle="0"/> 
                <TranslateTransform X="0" Y="0"/> 
            </TransformGroup> 
        </Rectangle.RenderTransform> 
    </Rectangle> 
    <Image RenderTransformOrigin="0.5,0.5" x:Name="image" Width="50" Height="50" Source="feed.jpg" Canvas.Left="10" Canvas.Top="10" Opacity="0.7" OpacityMask="#FF000000"> 
        <Image.RenderTransform> 
            <TransformGroup> 
                <ScaleTransform ScaleX="1" ScaleY="1"/> 
                <SkewTransform AngleX="0" AngleY="0"/> 
                <RotateTransform Angle="0"/> 
                <TranslateTransform X="0" Y="0"/> 
            </TransformGroup> 
        </Image.RenderTransform> 
    </Image> 
    <TextBlock Visibility="Hidden" x:Name="tooltip" Width="126" Height="38.75" Canvas.Left="62" Canvas.Top="66.75" Text="" TextWrapping="Wrap"/> 
</Canvas>

ToolbarButton.xaml.cs

using System; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Ink; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 

namespace SPFControls 
{ 
    public class ToolbarButton : Control 
    { 
        Storyboard _popup; 
        Storyboard _popdown; 
        Canvas _rootCanvas; 
        Image _image; 
        Rectangle _rectangle; 
        bool _mousedown = false; 
        LinearGradientBrush _pressed; 
        LinearGradientBrush _unpressed; 
        TextBlock _tooltip; 

        public event EventHandler<EventArgs> Click;  

        public ToolbarButton() 
        { 
            System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("Toolbar.ToolbarButton.xaml"); 
            _rootCanvas = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd()) as Canvas; 
            //_rootCanvas.MouseEnter += new MouseEventHandler(_rootCanvas_MouseEnter); 
            _rootCanvas.MouseLeave += new EventHandler(_rootCanvas_MouseLeave); 
            this.Loaded += new EventHandler(ToolBarButton_Loaded); 
            _popup = _rootCanvas.FindName("Popup") as Storyboard; 
            _popdown = _rootCanvas.FindName("PopDown") as Storyboard; 
            _rectangle = _rootCanvas.FindName("rectangle") as Rectangle; 
            _image = _rootCanvas.FindName("image") as Image; 
            _rootCanvas.MouseLeftButtonDown += new MouseEventHandler(_rootCanvas_MouseLeftButtonDown); 
            _rootCanvas.MouseLeftButtonUp += new MouseEventHandler(_rootCanvas_MouseLeftButtonUp); 
            System.IO.Stream s1 = this.GetType().Assembly.GetManifestResourceStream("Toolbar.Pressed.xaml"); 
            _pressed = XamlReader.Load(new System.IO.StreamReader(s1).ReadToEnd()) as LinearGradientBrush; 
            _unpressed = _rootCanvas.FindName("UnPressed") as LinearGradientBrush; 
            _tooltip = _rootCanvas.FindName("tooltip") as TextBlock; 

        } 

        void ToolBarButton_Loaded(object sender, EventArgs e) 
        { 
            UpdateLayout(); 
        } 

        void _rootCanvas_MouseLeave(object sender, EventArgs e) 
        { 
            _popdown.Begin(); 
            this.SetValue(Canvas.ZIndexProperty, 0); 
            _mousedown = false; 
            UnPressedLook(); 
            _tooltip.Visibility = Visibility.Hidden; 
        } 

        void _rootCanvas_MouseEnter(object sender, MouseEventArgs e) 
        { 
            _popup.Begin(); 
            this.SetValue(Canvas.ZIndexProperty, 5); 
            _tooltip.Visibility = Visibility.Visible; 
        } 

        void _rootCanvas_MouseLeftButtonDown(object sender, MouseEventArgs e) 
        { 
            _mousedown = true; 
            PressedLook(); 
        } 

        void _rootCanvas_MouseLeftButtonUp(object sender, MouseEventArgs e) 
        { 
            if (this.Click != null && _mousedown == true) 
            { 
                this.Click(this, EventArgs.Empty); 
                _mousedown = false; 
            } 
            UnPressedLook(); 

        } 

        void PressedLook() 
        { 
            _rectangle.Fill = _pressed; 
        } 

        void UnPressedLook() 
        { 
            _rectangle.Fill = _unpressed; 
        } 

        public Uri Image 
        { 
            get { return _image.Source; } 
            set { 
                _image.Source = value; 
            } 
        } 

        public new double Height 
        { 
            get { return ((FrameworkElement)this).Height; } 
            set 
            { 
                ((FrameworkElement)this).Height = value; 
                UpdateLayout(); 
            } 
        } 

        public new double Width 
        { 
            get { return ((FrameworkElement)this).Width; } 
            set 
            { 
                ((FrameworkElement)this).Width = value; 
                UpdateLayout(); 
            } 
        } 

        public string ToolTip 
        { 
            get { return _tooltip.Text; } 
            set { _tooltip.Text = value; } 
        } 

        void UpdateLayout() 
        { 

            _rootCanvas.Height = Height; 
            _rootCanvas.Width = Width; 
            _rectangle.Height = Height; 
            _rectangle.Width = Width; 
            _image.Height = Height - 20; 
            _image.Width = Width - 20; 

        } 
    } 
} 

Pressed.xaml

<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> 
  <GradientStop Color="#FF6392C7" Offset="0.125"/> 
  <GradientStop Color="#FF6392C7" Offset="0.88"/> 
  <GradientStop Color="#FFF8F2F2" Offset="0"/> 
  <GradientStop Color="#FFF8F2F2" Offset="1"/> 
</LinearGradientBrush> 

Advertisements

16 thoughts on “Toolbar source

  1. longshot says:

    Hi, thanks for the work. Could you post an example of how to use this in code? The debugging tools make it pretty difficult to figure out what is going wrong when I try to use this in my code.

  2. xaml would look something like this

    Page.xaml.cs Code looks like this

    using System;
    using System.Linq;
    using System.Xml;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;

    namespace ControlApplication
    {
    public partial class ControlUse : Canvas
    {

    TextBlock _textblock;
    SPFControls.Toolbar _toolbar;

    public void Page_Loaded(object o, EventArgs e)
    {
    InitializeComponent();
    Canvas canvas1 = o as Canvas;
    _textblock = canvas1.FindName(“txtValue”) as TextBlock;
    _toolbar = canvas1.FindName(“toolbar”) as SPFControls.Toolbar;

    for (int i = 0; i (tb_Click);
    _toolbar.ToolBarCollection.Add(tb);
    }
    }

    void tb_Click(object sender, EventArgs e)
    {
    _textblock.Text = ((SPFControls.ToolbarButton)sender).Image.ToString();
    }
    }
    }

  3. Your code for Page.xaml.cs return quite a bit of error. would you please post the correct version for page.xmal and page.xmal.cs? thanks a lot in advance!!!

    Sue

  4. Anderson Lin says:

    Hi Vivekdalvi,
    After I download the ToolbarApplication.zip file and I try to run it from Visual Studio 2008 beta 2 version. And also, I change the Silverlight.js from 0.9 version to 1.1 version. Then I recompile the source code with no errors , and I did not see the output of “toolbar” button come out in the Browser. Can you tell me anything wrong after I change to 1.1 version of Silverlight?
    The reason I change to 1.1 because only version 1.1 available in current application. The following is the Silverlight.js and ControlUse.html file.

    if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.ua=null;Silverlight.available=false;Silverlight.fwlinkRoot=”http://go.microsoft.com/fwlink/?LinkID=”;Silverlight.detectUserAgent=function(){var a=window.navigator.userAgent;Silverlight.ua={OS:”Unsupported”,Browser:”Unsupported”};if(a.indexOf(“Windows NT”)>=0)Silverlight.ua.OS=”Windows”;else if(a.indexOf(“PPC Mac OS X”)>=0)Silverlight.ua.OS=”MacPPC”;else if(a.indexOf(“Intel Mac OS X”)>=0)Silverlight.ua.OS=”MacIntel”;if(Silverlight.ua.OS!=”Unsupported”)if(a.indexOf(“MSIE”)>=0){if(navigator.userAgent.indexOf(“Win64”)==-1)if(parseInt(a.split(“MSIE”)[1])>=6)Silverlight.ua.Browser=”MSIE”}else if(a.indexOf(“Firefox”)>=0){var b=a.split(“Firefox/”)[1].split(“.”),c=parseInt(b[0]);if(c>=2)Silverlight.ua.Browser=”Firefox”;else{var d=parseInt(b[1]);if(c==1&&d>=5)Silverlight.ua.Browser=”Firefox”}}else if(a.indexOf(“Safari”)>=0)Silverlight.ua.Browser=”Safari”};Silverlight.detectUserAgent();Silverlight.isInstalled=function(d){var c=false,a=null;try{var b=null;if(Silverlight.ua.Browser==”MSIE”)b=new ActiveXObject(“AgControl.AgControl”);else if(navigator.plugins[“Silverlight Plug-In”]){a=document.createElement(“div”);document.body.appendChild(a);if(Silverlight.ua.Browser==”Safari”)a.innerHTML=”;else a.innerHTML=”;b=a.childNodes[0]}if(b.IsVersionSupported(d))c=true;b=null;Silverlight.available=true}catch(e){c=false}if(a)document.body.removeChild(a);return c};Silverlight.createObject=function(l,g,m,j,k,i,h){var b={},a=j,c=k;a.source=l;b.parentElement=g;b.id=Silverlight.HtmlAttributeEncode(m);b.width=Silverlight.HtmlAttributeEncode(a.width);b.height=Silverlight.HtmlAttributeEncode(a.height);b.ignoreBrowserVer=Boolean(a.ignoreBrowserVer);b.inplaceInstallPrompt=Boolean(a.inplaceInstallPrompt);var e=a.version.split(“.”);b.shortVer=e[0]+”.”+e[1];b.version=a.version;a.initParams=i;a.windowless=a.isWindowless;a.maxFramerate=a.framerate;for(var d in c)if(c[d]&&d!=”onLoad”&&d!=”onError”){a[d]=c[d];c[d]=null}delete a.width;delete a.height;delete a.id;delete a.onLoad;delete a.onError;delete a.ignoreBrowserVer;delete a.inplaceInstallPrompt;delete a.version;delete a.isWindowless;delete a.framerate;delete a.data;delete a.src;if(Silverlight.isInstalled(b.version)){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener(“onunload”,Silverlight.__cleanup,false);else window.attachEvent(“onunload”,Silverlight.__cleanup);var f=Silverlight._silverlightCount++;a.onLoad=”__slLoad”+f;a.onError=”__slError”+f;window[a.onLoad]=function(a){if(c.onLoad)c.onLoad(document.getElementById(b.id),h,a)};window[a.onError]=function(a,b){if(c.onError)c.onError(a,b);else Silverlight.default_error_handler(a,b)};slPluginHTML=Silverlight.buildHTML(b,a)}else slPluginHTML=Silverlight.buildPromptHTML(b);if(b.parentElement)b.parentElement.innerHTML=slPluginHTML;else return slPluginHTML};Silverlight.supportedUserAgent=function(c){var a=Silverlight.ua,b=a.OS==”Unsupported”||a.Browser==”Unsupported”||a.OS==”Windows”&&a.Browser==”Safari”||a.OS.indexOf(“Mac”)>=0&&a.Browser==”IE”;if(c==”1.1″)return !(b||a.OS==”MacPPC”);else return !b};Silverlight.buildHTML=function(c,d){var a=[],e,i,g,f,h;if(Silverlight.ua.Browser==”Safari”){a.push(“‘+””}else{a.push(‘”;i=’ ‘;h=””}a.push(‘ id=”‘+c.id+'” width=”‘+c.width+'” height=”‘+c.height+'” ‘+e);for(var b in d)if(d[b])a.push(i+Silverlight.HtmlAttributeEncode(b)+g+Silverlight.HtmlAttributeEncode(d[b])+f);a.push(h);return a.join(“”)};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a=”\nSilverlight error message \n”;a+=”ErrorCode: “+d+”\n”;a+=”ErrorType: “+c+” \n”;a+=”Message: “+b.ErrorMessage+” \n”;if(c==”ParserError”){a+=”XamlFile: “+b.xamlFile+” \n”;a+=”Line: “+b.lineNumber+” \n”;a+=”Position: “+b.charPosition+” \n”}else if(c==”RuntimeError”){if(b.lineNumber!=0){a+=”Line: “+b.lineNumber+” \n”;a+=”Position: “+b.charPosition+” \n”}a+=”MethodName: “+b.methodName+” \n”}alert(a)};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(f){var a=null,h=Silverlight.fwlinkRoot,c=Silverlight.ua.OS,b=”92822″,d,e=”Get Microsoft Silverlight”,m=”0x409″;if(f.shortVer==”1.1″)f.inplaceInstallPrompt=false;if(f.inplaceInstallPrompt){var j;if(Silverlight.available){d=”94376″;j=”94382″}else{d=”92802″;j=”94381″}var i=”93481″,g=”93483″;if(c==”Windows”){b=”92799″;i=”92803″;g=”92805″}else if(c==”MacIntel”){b=”92808″;i=”92804″;g=”92806″}else if(c==”MacPPC”){b=”92807″;i=”92815″;g=”92816″}var l=’By clicking “Get Microsoft Silverlight” you accept theSilverlight license agreement‘,k=’Silverlight updates automatically, learn more‘;a=”+l+”+k+”;a=a.replace(“{2}”,h+i);a=a.replace(“{3}”,h+g);a=a.replace(“{4}”,h+j)}else{if(f.shortVer==”1.1″){b=”92821″;if(Silverlight.available)d=”94378″;else d=”92810″;if(c==”Windows”)b=”92809″;else if(c==”MacIntel”)b=”92813″}else{if(Silverlight.available)d=”94377″;else d=”92801″;if(c==”Windows”)b=”92800″;else if(c==”MacIntel”)b=”92812″;else if(c==”MacPPC”)b=”92811″}a=”}a=a.replace(“{0}”,b);a=a.replace(“{1}”,h+d+”&clcid=”+m);return a};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a–){window[“__slLoad”+a]=null;window[“__slError”+a]=null}if(window.removeEventListener)window.removeEventListener(“unload”,Silverlight.__cleanup,false);else window.detachEvent(“onunload”,Silverlight.__cleanup)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b=””;if(c==null)return null;for(var d=0;d96&&a64&&a43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+”&#”+a+”;”}return b}

    controluse.html

    Silverlight Project Test Page

    .silverlightHost { width: 1000px; height: 680px; }

    createSilverlight();

  5. Hi,

    I downloaded your sample “ToolbarApplication”. I’m getting the error when Toolbarbutton is trying to load XAML file at the constructor.. .

    {“Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))”} System.Exception

    Any idea? is this cuz of animation things?

  6. Pingback: Michael Sync » Silverlight 2.0 - How to design the blog theme with Silverlight

  7. Reza Mohamed says:

    How did you guys get Viveks’ code to work? I downloaded the code, and replaced the silverlight.js with the new sivlerlight.js file..and when i build and run the solution, nothing comes up on the browser.
    thanks

  8. Ravi says:

    Hello Friends….
    I have created the application as above given code, i am using SL 2 beta 2.but my application is not responding and giving me error as follows :

    Error 1 The type or namespace name ‘NotifyCollectionChangedEventArgs’ could not be found (are you missing a using directive or an assembly reference?)

    Can any one help ?

  9. At the time when I created this sample, Neither ObservableCollection nor NotifyCollectionChangedEventArgs were part of the runtime but with SL Beta2 they are part of runtime. They are both in System.Windows.dll. ObservableCollection is in System.Collections.ObjectModel and NotifyCollectionChangedEventArgs is in System.Collections.Specialized.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s