RE: Generating path language strings
Expression Design has a larger range of vector drawing tools than Blend, and can export as XAML, or you can copy and paste the XAML. You're right. I rarely use Expression Design except to make some simplistic images with coloured shapes. I read the F1 help on paths, creating and found it quite easy to make some pretty shapes, then export as XAML WPF Resource Dictionary. I get more than I need, but the path string I want is inside. This technique will be fine for my modest upcoming needs. Ooops! I just noticed that the coordinates of the points are slightly offset. I made a rectangle that snapped into the top-left and you can see it's not a 0,0. Geometry=F1 M 152.167,108.167L 0.5,108.167L 0.5,0.49998L 152.167,0.49998L 152.167,108.167 Z I guess I can live with this quirk. The technique of Convert bitmapped images to paths might be useful. Joseph, thanks for pointing out the existence of inkscape. It's a shame that SVG scalable vector graphics aren't useful in WPF or Silverlight development. Thanks Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Generating path language strings
Earlier this year someone pointed me to the Styled ListBox http://richapps.wordpress.com/2009/02/12/advanced-styling-wpf/ sample. I was quite impressed the clever trick of totally restyling the ListBox control and item templates into a list polygons. I managed to convert the control to Silverlight, but it was a pain to convert the triggers into visual states, remove other non-WPF properties, and I took out some of the animations as being overkill. The polygon shapes are defined with path language strings which are appallingly difficult to write and read when they get complicated. Here is the shape of the US state of New Mexico for example (a very simple one): F1 M 310.903,289.889L 228.569,281.556L 215.569,377.222L 228.903,378.222L 229.569,371.556L 252.903,373.556L 252.903,370.556L 304.236,375.889L 310.903,289.889 Z I will soon need to create paths for Australian states, Melbourne suburbs and other arbitrary artistic shapes and I was wondering how to do this. I suppose the states and suburbs are in public government sites somewhere that I can't find yet (and they're probably in the wrong format for me). What about generating paths for shapes of my own? Is there some tool that can help me draw pretty shapes and get path strings for them? Blend? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Blend interactivity and animations
Shane (and others), how on earth did you create the animation code last week that used the interactivity namespace? I just created a simple SL4 app with a single ListBox, opened it up in Blend 4 and bumbled around to try and add a mouse-over behaviour to make it expand. I hardly ever use Blend and can't drive it properly, but I only have 15 behaviours built-in and none of them seem to do what I want (see picture). Am I missing plug-in behaviours? Am I in the wrong pane? -- Greg image001.png___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Storyboard crash
Chui has it! Storyboard.TargetProperty=(TransformGroup.RenderTransform).Children[0].Angl e From=90 To=0 Now I look again, this makes the TargetProperty match the first child of the control's RenderTransform. What confuses me is that I pasted the original XAML over from a WPF app where it was working the wrong way. This subtle change makes it work in Silverlight. comn:WidgetHelpControl x:Name=helpCtl comn:WidgetHelpControl.RenderTransform TransformGroup RotateTransform Angle=90 CenterX=200 CenterY=200 / ScaleTransform CenterX=200 CenterY=200 ScaleX=0.0 ScaleY=0.0/ /TransformGroup /comn:WidgetHelpControl.RenderTransform /comn:WidgetHelpControl Thanks heaps, the corny zoom-out animation impresses dumb schmucks in marketing. I guess that's why animations were invented. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Browser scroll bars
Back again ... I'm plagued by random scroll bars appearing when I resize IE containing my SL4 app which fills the window (see pic). For an hour I've been fiddling with width, height and overflow in the css and the html, but it only alters the symptoms slightly. Web searches find lots of complaints about this and (as usual) all of the advice is useless. Perhaps the answer is out there, but I can't find it in all the noise. I thought I'd ask in here and see if anyone has found a definitive way of getting rid of the scroll bars. I tried dozens of combinations of adjustments of width, height and overflow without success. Greg P.S. I started with the default html page that is generated by the VS2010 project template. image001.png___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Storyboard crash
Folks, in the XAML and code below I'm getting the crash Cannot resolve TargetProperty RenderTransform.Children[0].Angle on specified object. It all looks correct to me, can anyone see what's wrong? This code was copied from a WPF app where it's working fine and creates a nice spinout effect on a control. In my SL4 app it dies -- Greg var spinout = (Storyboard)grid.Resources[StorySpinout]; spinout.Begin(); Grid x:Name=LayoutRoot Grid.Resources Storyboard x:Key=StorySpinout Duration=0:0:1.0 BeginTime=0:0:0.2 DoubleAnimation Storyboard.TargetName=helpCtl Storyboard.TargetProperty=RenderTransform.Children[0].Angle From=90 To=0 DoubleAnimation.EasingFunction BackEase EasingMode=EaseOut Amplitude=0.5/ /DoubleAnimation.EasingFunction /DoubleAnimation DoubleAnimation Storyboard.TargetName=helpCtl Storyboard.TargetProperty=RenderTransform.Children[1].ScaleX From=0.0 To=1.0/ DoubleAnimation Storyboard.TargetName=helpCtl Storyboard.TargetProperty=RenderTransform.Children[1].ScaleY From=0.0 To=1.0/ /Storyboard /Grid.Resources comn:WidgetHelpControl x:Name=helpCtl comn:WidgetHelpControl.RenderTransform TransformGroup RotateTransform Angle=90 CenterX=200 CenterY=200 / ScaleTransform CenterX=200 CenterY=200 ScaleX=0.0 ScaleY=0.0/ /TransformGroup /comn:WidgetHelpControl.RenderTransform /comn:WidgetHelpControl /Grid ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Animating an image
So Shane, thanks, I can use triggers! I just had this mental warning that triggers weren't in SL4 ... Ah but I see you're using interactivity, which I can't recall using before. It looks like I'm missing out on a few tricks. I'll paste your code into the app later and see how it goes. I hope you're right and can avoid procedural code. I presume you created that XAML using Blend, which you may recall gives me bowel motions. I'll let you know how it goes. Grant, don't forget that you're on the other side of my screen, so what looks left to me in front of the screen is on the right for all of you out there ;-) Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Animating an image
Shane et al, after considering the structure of my app I had to create the animations and storyboard for the help icon in code. I have a base class for all of my controls containing the help icon, so it's convenient to put the clump of ugly code in there. However, the result is quite nice as the icon pulsates up and down as you mouse over. Then I remembered I forgot something else about Silverlight ... there are no document classes (FlowDocument, etc). I was going to format the help text as nice documents, but I'll have to find another way. I think my choices are limited to TextBlock and Run for formatting. What else is there? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Animating an image
Silverlight 5 can flow between text boxes. I forget the tag. The RichTextBox in SL4 might be my saviour. I'm playing with it now -- Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Animating an image
Folks, I've been writing WPF for several weeks and I just returned to doing some SL4 coding. I've already forgotten if I can do something declaratively, or I need code, or a bit of both. I've placed a small help Image at the bottom left of charts (see screen shot) and I'd like the image to expand on mouse over with a tooltip (then if they click it I will replace the chart with a full help display). I've just forgotten how to make the expanding effect in SL4. I don't think I can use triggers in XAML, so I just need confirmation that code is required. Greg image001.png___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Creating Office documents
Folks, we've had requests for our SL4 app to generate Word, Excel and PowerPoint files. Security restrictions normally prevent this and there are problems with dependencies on the client. At the moment as a workaround we simply paste XML and text into the clipboard and the user then pastes it into Excel. We noticed that no other competitive SL apps generate Office documents, so I presume they have given up trying to overcome the security sandboxing like we did. However, we've had fresh requests so I thought I'd mention the topic in here in case there are new products and techniques that I'm not aware of. I think if our App is installed as a trusted out-of-browser app then it do what we want, but we think it's unlikely that anyone will do that, and we haven't tried it anyway. Perhaps we could generate the documents on the server side, place them in a public URL and give the SL user a hyperlink to them. Has anyone tried this? Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Tracing deployed app
Folks, I have one of those stinkers where my SL4 app woks nicely on my dev machine, but when it's deployed to the live server it behaves incorrectly. So I'm wondering what the easiest way is to log/trace what's happening inside the app on the live machine. In a previous app I had laced the code with my own logging which I put into a rolling array, and I had a button in the UI to show the lines in a list box. It works, but it's completely hand-written. I could add similar manual logging to my new app, but before I do that rather tedious work I was wondering if there are better ways of tracing/logging what's happening inside my SL4 app (inside IE8) on a live machine. It would be nice if I could add logging calls to my code, but let something else do the work of catching and displaying the data (like the Trace infrastructure). Perhaps there are tricks and techniques I'm not aware of. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Enumerating children of a type
Jordan, I'm writing a general purpose dashboard where it can be populated with various charts, pickers, panels etc in different ways. I ask for blocks of XML to feed into the various controls, so it's all rather flexible and dynamic. I have to match the id of a block of XML to a child control (somewhere down the tree) with a matching id and pass it the XML to render. I was wondering how binding could used in this situation, but rather than create some obtuse but lovely wedding cake binding library, in haste I decided to just find the child and shove the XML into it (10 lines of code). If this thing goes live then I'll go back to making a nice cake out of it. I eventually decided I like this bit of code for enumerating children of a certain type (can it be made better?) public static IEnumerableT GetVisualsT(this DependencyObject root) where T : DependencyObject { int count = VisualTreeHelper.GetChildrenCount(root); for (int i = 0; i count; i++) { var child = VisualTreeHelper.GetChild(root, i); if (child is T) { yield return (T)child; } foreach (var descendants in child.GetVisualsT()) { yield return descendants; } } } As an aside: I said several months ago that making general purpose utility routines enumerable is vitally important ... so you can parallelise them. Back then I had a file scanning routine which ran for 40 minutes or so, when I used DirectoryInfo.EnumerateFiles with Parallel.For it took less than 10 minutes. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Enumerating children of a type
I find I'm often enumerating down the visual tree looking for child controls of a certain type. Is there an elegant and reliable way of coding this that people prefer? -- Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
you need to install the latest silverlight developer runtime
Sometime yesterday I wanted to watch a video and I was asked to install the latest Silverlight, stupidly I said yes. It seems to have been V5 I installed. Now I can't open any SL4 projects due to: you need to install the latest silverlight developer runtime. So from Programs and Features I uninstalled Silverlight (V5), but it makes no difference. So bumbling around as usual I just uninstalled-reinstalled SL4 SDK but it makes no difference. I have absolutely no clue about what to do, neither does anyone else from looking at web searches. It's been 45 minutes now, and I have no clues or ideas about what to do to get my dev environment back the way it was yesterday morning. Any ideas? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
In praise of slsvcutil.exe
Folks, Thanks to a hint by Brendan in the Silverlight forum I was led to find this utility (on my machine): %ProgramFiles(x86)%\Microsoft SDKs\Silverlight\v4.0\Tools\slsvcutil http://msdn.microsoft.com/en-us/library/cc197958(v=vs.95).aspx .exe Thank heavens for this, as it means I can now generate the service reference code for a Silverlight project the same way I have been using svcutil for normal projects. I haven't used the Add Service Reference in normal projects for years because the code generated by svcutil is easier to control and far less cluttered. I highly recommend that people gen the code this way instead of using add reference. I was wondering what the equivalent was for SL projects and what the build process what doing internally. Ages ago I used some monitoring tools and various tricks to find what was happening internally but was defeated and gave up. I'm not sure if slsvcutil existed then, but it does now. I also fell for the bug described here http://blogs.msdn.com/b/silverlightws/archive/2010/04/30/workaround-for-sta ckoverflowexception-when-using-slsvcutil-exe.aspx and had to use the workaround to get slsvcutil working. I hope this tool helps others avoid the shocking problems I had this morning with a corrupt service reference. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Another typical problem
Well it's happened again. I spent two hours this morning refactoring a demo SL4 project to prepare for expansion. I split a few classes, tidied things up, etc. I hit F5 to run and it says I have a cross domain call failure. I spent the next two hours trying to fix this problem. I removed and added the service ref again about 40 times in different ways, I searched the web and all of the advice is worse than useless. I even had bizarre errors adding the ref back again like Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information which I've never had before and advice in this matter is useless. The referenced service didn't even change, it's not in the solution. I didn't add any new service types. I have now spent 4 hours trying to get a previously working demo project going again without hope. I could restore everything and incrementally reapply my morning's changes, but that would take another 2 hours. I created a fresh SL4 project and web app out of the wizard, added the save service ref and it works. So something has gone wrong with my demo project and nothing seems to resurrect it. My only hope therefore is to slowly paste the contents of the old app into the fresh one and pray that it keeps working. I estimate that this will take 6 hours. I've been writing software for 35 years and I haven't seen such f***ing mind-blowing instability and idiocy and insanity before and it just seems to get worse and worse with every passing year and every new kit and tool and framework that comes out. Are we going through a historical period in IT history where everything is actually dis-integrating? Is it an internal joke by Microsoft to cull the weak and breed a new generation of drone developers who just accept that everything doesn't work? I spend more time searching the web for answers to insane problems that and I do actually coding, and most of the time I get no answers or increasing numbers of stupid answers cluttering the web. More and more often I get problems where quite simply I have no frigging idea what to do. There are no meaningful clues and no obvious course of action. The only thing to do is delete stuff, jiggle options, add stuff back, restart IIS, reboot, restore backups, compare old and new files, etc. There is usually no diagnostic path to follow, you just bumble around until you get a different (less worse) error that might give you a clue. Is this the future of software development? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Complex region selection
Thanks Richard, you have mentioned some very interesting tools and techniques, so technically interesting in fact that I feel compelled to get the tools and play with them. I refuse to be defeated by shapefiles - Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Complex region selection
Folks, coming soon in our app is the need for a map region selector where you click on states of America or European counties for example. I see the problem broken into a few pieces: * defining the complex regions and hoping that there are public sets of coordinates that define famous boundaries like countries and states * zooming around the map to select small regions (like Luxembourg) * hit testing and pleasing animations on mouse over and click. If anyone has been through this exercise before then I'm keen to hear advice. I'm hoping that I won't have to do everything manually from first principles with raw code and drawing primitives. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Complex region selection
Carl, unfortunately there is no chance of using SQL Server in this app. I have a fat book chapter http://www.microsoft.com/learning/en/us/book.aspx?id=12805 here on spatial data that I'd like to try out, but this isn't a chance. I'm still web searching for some kind of control or library which might do the heavy lifting for me -- Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Complex region selection
Chris, that's a really weird sample, putting it in a ListBox, I mean he could have put it all in a Canvas to be more realistic. However there are some interesting clues inside. He has the XML state coordinates, so they (and other stuff) must be publicly available somewhere (I'm still looking) -- Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: A typical few hours
This is a common problem. Same in WPF as well. My work around, for cases where I desperately want radiobuttons, is the following. 1. Create your radiobuttons,each with a different groupname. 2. Bind each radiobutton to a different property and manually set the other properties to false when one of the others is true. After 6 months I fell for this trap again this morning (in a WPF app). I called CancelEdit on an IEditableObject and everything in the UI reverted except the radio buttons. After sticking some displays on the property setter I saw it flipping back and forth between values and then I remembered this thread in the Silverlight forum. I found that putting a different GroupName on the radio buttons was sufficient, no need to bind to different properties. I'm using a typical Enum-RadioButton converter that you see all over the place. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: 16/32 bit plugin
Man, I must have been in a time-warp in my head by writing 16/32 bit. Luckily 8-bit was before my time. The IBM mainframe was 32-bit, but they only used 24 bits for addresses until they ran out of space and had to permanently borrow the other 8 bits. Luckily 64KB of RAM was plenty. AFAIK, there is no 64-bit version of the Silverlight plugin available, hence what you're downloading and installing is the 32-bit version, Good grief! Is this right? Maybe I heard this once but it went in one ear and out the other. I can't run Silverlight 4 on a 64-bit IE?! Even worse, you just reminded me that I have to migrate my SL4 app to Sl5 sometime soon, that'll be fun. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
16/32 bit plugin
Folks, somehow I have the SL4 plugin for IE9 16-bit installed and working (I can't recall how it got there). I usually browse with IE9 64-bit and when I hit some SL4 content it asks me to install Silverlight. If I let it continue it goes through the motions and then tells me The same version of Silverlight is already installed. So the existing 16-bit version seems to be blocking the 32-bit version from arriving ... how can I get 32-bit plugin installed? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
DataGrid row button click
Folks, I think I've outsmarted myself. I have a DataGrid bound with a template column containing a Button and it's all looking quite acceptable. Now I'm a bit flummoxed, as when one of the buttons is clicked I have to find out which object in the data source is behind the row containing the button. Unlike the WinForms grid, I have no RowIndex or similar property to help me, all I have are two properties on the Click event: sender and e.OriginalSource, which seem to be the same. I'll probably have to walk backwards up the control tree somehow to find the row and the item it's bound to, but I don't know how yet. Has anyone done this and got clues? I'll keep web searching in the meantime. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: DataGrid row button click (answered?!)
To find the DataGridCell that contains the clicked button I found that a simple iteration up through the Parent properties of the sender eventually reaches the cell. I don't go to the trouble of using the VisualTreeHelper as the Parent property was enough in this case (I was doing that in a WPF app). The DataContext property of the cell can luckily be cast to the object type in the bound collection. I get the creeps about how fragile this all is, having no strongly typed or nicely indexed values to work with. Are we sure this is the way we're intended to do these things? I have this feeling of unease that there is some technique that I'm missing, but I doubt it. If you are using MVVM, then you can bind your button to a command on the object being bound to. How do you pass to the command handler something to identify the button/row/object being acted upon? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: DataGridCheckBoxColumn (fixed?!)
It’s all working now. It turns out I didn’t need to walk up anywhere for the DataContext, as the I managed to embed a C1 colour picker control into the template cell and bind it directly to the Colour property. The screen shot I’ve pasted below (if your email can see it) shows how I’ve bound a grid to a data source with bool and Colour properties and it all works with little code. I did have to use template cells as the CheckBoxColumn has stupid behaviour I previous whinged about. The Colour cell is a Grid with a TextBlock and the picker. I used a converter to show the grid background colour and friendly text. I had many subtle problems with column sizing, binding choices and the poor C1 documentation about their picker, so it took many hours to get this innocuous looking screen working. I will soon need to have a Combobox in a DataGrid cell and I’m not expecting that experience to be hugs and puppies either -- Greg image001.png___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
DataGridCheckBoxColumn
So I bind some DataGrid columns and one of them is a bool which corresponds to a DataGridCheckBoxColumn. It all displays nicely and I get excited. Then I notice that clicking the CheckBox cell puts it in edit mode, then I click it again to change the value. Then I notice that the binding change doesn't fire until I press Enter or Tab or whatever to change focus. So it takes 3 gestures to change a value in a CheckBox column. This is unacceptable for this app. I see many people complain about the first quirk and suggest you use a template column or more code and tricks as a workaround, but it all looks fragile, unreliable and I can see myself burning another few hours of unpaid time and it all probably won't work anyway. No one seems to mention the focus problem. In WinForms you have to trap the cell dirty change event and commit to the data source, but there is no equivalent I can find. Nor does the UpdateSourceTrigger have a PropertyChanged value. So I'm stuffed again. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: DataGridCheckBoxColumn (fixed?!)
Good grief, the advice to use a template column instead of a check box column seems to work. A single gesture is required to toggle the check and update the bound property. Who would have guessed?! Greg data:DataGridTemplateColumn data:DataGridTemplateColumn.CellEditingTemplate DataTemplate CheckBox IsThreeState=False IsChecked={Binding IsBar,Mode=TwoWay} ... / /DataTemplate /data:DataGridTemplateColumn.CellEditingTemplate /data:DataGridTemplateColumn ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: RE: Failed to invoke: Javascript function
Maybe there is a javascript error on the page causing problems. I don't see one in the browser. I've tried running the SL4 app in debug and non-debug modes but I get no extra information from anywhere, just the same Failed to Invoke error. No helpful diagnostic information is anywhere that I can find via any trick I can think of so far. Even if the JavaScript function doesn't exist I get the same error. InvalidOperationException is all I get and nothing else to help me, so it's not even getting as far as the browser. It's like a typical security roadblock, but there are no hints that it is one in this case. This is just a perfectly normal SL4 app with no weird things happening, it's just calls a WCF service to send XML back and forth and that's all working fine. I will now compare the html an scripts generated by the VS2010 wizard and my live ones. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: RE: Failed to invoke: Javascript function
HtmlPage.Window.Alert(Test); as per this thread http://forums.silverlight.net/t/211409.aspx/1 Alert works. I have spent another two hours trying to get the Invoke working. I looked back to June 2010 in version control to see who I did a similar testing technique then. I used GetProperty() to get a ScriptObject and then InvokeSelf. That code no longer works and I get null back from GetProperty. I have tried dozens of script functions signatures and nothing changes. I have moved the script to different places but nothing changes. I tried calling OnSilverlightError (the function generated by the wizard) and I get a different error Object doesn't support property or method 'getHost', but that gives me no clues. I also tried renaming my function to OnSilverlightError but I get no clues. So after 4 man-hours of trying to get any JavaScript function work (even an empty one) I only get the Failed to Invoke error and I have no clues. I only know that a fresh wizard generated SL4 app does Invoke okay and my real one doesn't. So here we are well into the 21st century in the age of science fiction and I'm still spending half of my working life trying to get hello world scripts to run. Even on mainframes I had core dumps to analyse, now I usually have nothing but sorry for the inconvenience. Silverlight, WPF, WCF and security blocks are fucking killing me, I'm wasting time, losing money and going mad and losing sleep, and this has been going on for years now with absolutely no sign that anything will improve. Oh well, now I will waste another hour up until 1:30am trying to get script debugging working in VS2010 (as John just suggested), but I'm sure if I do get it working (I thought it already was?!) then I will learn nothing and be right back where I started two days ago. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
attempting to access a service in a cross-domain way
Folks, I've just created a hello world WCF web service with basicHttpBinding which I know is working correctly from URL http://localhost/PhotoService/Service1.svc. I created a simple Silverlight 4 app with a single button to call the service to sanity check it's working. It dies with this: An error occurred while trying to make a request to URI 'http://localhost/PhotoService'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. Web searches hint that I need a clientaccesspolicy.xml file and they argue about where it's supposed to be placed (I'm still not sure where). However, I have other apps like this one I've just created and none of them need a policy file. I've never created one before. What's going on this time?! Is there some trick I've forgotten? Any ideas anyone? Thanks Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Streamed upload to WCF service [2]
Further reading indicates that it is not possible to use a Stream object in a SL4-to-WCF contract. http://blogs.msdn.com/b/carlosfigueira/archive/2010/07/08/using-transfermode -streamedresponse-to-download-files-in-silverlight-4.aspx I created a test method in my service for experiments and I find that the proxy generator converts a Stream into a byte[]. The link above uses a ChannelFactory to hack in at the Message level and simulate streaming at a low level. It all looks like a fragile mess to me. So now I'm even more puzzled than when I started. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Refreshing an SL4 app
Folks, I have this random problem where I xcopy deploy all of my app files over to my Win2008 server box and the updated SL4 app doesn't appear, I get the previous version. I have spent hours over the previous months trying to figure this problem out. I restart IIS, I even reboot, I delete the 'Temporary ASP.NET Files' folders and I do a voodoo dance, but nothing will make the new app appear. Sometimes after another wasted half hour of stuffing around it suddenly comes good. But as is the new tradition of software development: I don't know what went wrong and I don't know what goes right. Anyone else suffered this and sorted it out? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Refreshing an SL4 app (client problem?)
Well I should have asked my cat, because I browsed to the SL4 app from the outside world and it was the latest version. When browsing from my work machine I see the old version. So I restart my localhost IIS and delete temporary files in the browser, but it makes no difference. As an administrator I delete all local v2 and v4 ASP.NET temporary files and restart IIS, now it's fixed. So it looks like the problem was on my client side, not on the server machine side. I'm not sure which step fixed the problem, but it *might* have been deleting the local temporary files. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Refreshing an SL4 app (client problem?)
http://stackoverflow.com/questions/2281919/expiry-silverlight-xap-file-from- browser-cache-programmatically Interesting ... some solutions are browser specific, some need code and maintenance. Adding the Cache-Control: no-cache header seems the easiest by far, so I'll try it out at the app level (it's under the IIS - HTTP Response Headers). I'm not feeling confident. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
A typical few hours
So I have a plain class object as the DataContext for a UserControl with a variety of controls on it. All of the two-way binding works perfectly except for a group of 3 radio buttons which seem to change their checked states in an incomprehensible random way. For over 3 hours I stick debug displays into every crack I can find, I swap code in and out, I try it on different controls, I fiddle with the bool-enum converter, but absolutely nothing makes any difference. Similar radio buttons on another similar control work perfectly, only this one is stuffed. I eventually deleted all binding code for the radio buttons and used an old WinForms style get/set property and it works. I think this is a really typical case of what I've been complaining about for two years now, and it's getting worse. As my working days pass, more and more roadblocks, workarounds, gotchas and bugs degrade my work satisfaction and income. Most of this suffering continues to come from Silverlight, WPF and WCF. NRN, I'm just venting my boiling spleen. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: A typical few hours
Winston, no binding errors in the output window. It's a plain class that implements INotifyPropertyChanged. Jake, don't tell me ... someone (you!) has suffered this before, and I didn't run the correct web searches, and I wasted my time while wasting time. I see your post now, but I've got to cook dinner, so I'll come back and digest it later (after the food). At a glance, your description matches my symptoms. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
SL4 Drag and drop
Has anyone here got a sample (or can find one) of how to perform drag and drop in SL4 using the basic events and logic? I presume that the necessary code to do this is not a tangled nightmare. I have performed drag-and-drop in WinForms apps many times, so I'd just like to know what the equivalent code is in SL4. All the samples I can find use the toolkit drop target which doesn't look useful for me. It seems to have some miraculous behaviour whereby it knows what to drop where. Only I know where things can be dropped. I'm actually trying to allow a drag of a node in a ComponentOne TreeView control to another TreeView. I have tried using the C1DragDropManager class supplied by C1, but when I follow the sample code absolutely nothing happens, no events are raised. To make things worse, the samples from C1 are really unclear and they don't describe the absolute basics such as when the class can be used and what can be dragged in what circumstances. This is typical of 3rd party kits which are convoluted beyond belief. As you can tell, I'm getting pretty frustrated as I've spent almost 2 solid hours now stuffing around with C1 classes and searching the web without success. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
IE9 styles warning
Folks, just a heads up. Sometime over the weekend I let an IE9 update come in. This morning I run my SL4 app and it's crushed up into the top inch of the screen. Fiddling with styles and Height on the parent html page made no difference. So in VS2010 I created a fresh SL4 project and found that the empty app would fill that browser window as a I want. I replaced my html page with the freshly created one and merged a few changes back into it. It was still crushed up on the top of the page. I deleted the form tag pair and now it fills the window as I want. Then I put the form tab back and it filled the screen. It's the old TV repairman's problem again and I don't know what was wrong and I don't know what went right. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Visifire vs ComponentOne
Folks, I think I have a small lesson in marketing for you, or it's a commentary on human nature. For over a year we used the Visifire 2.2.4 charting library for Silverlight. Six months ago we had to move to ComponentOne because they provided gauges and radar charts, at a cost of about $1500/year with support. Although the C1 library seems to have more chart types and more properties (and hence more complexity and documentation) than Visifire, it looks as dull as dishwater. The Visifire charts have pleasant animations so that bars spring elastically and pie charts unwind into view. Visifire also has tooltips over the data points to show the values. C1 has none of this and you have to do it all in code, and it's so obscure we had to get C1 support to kindly give us some sample code to customise rendering. As a result of this move from Visifire to C1, users and sales have complained that the springy charts have gone away and it's all dull. The architect has said the idiots don't care what the numbers are on the charts, they just want to have eye-candy. I can understand this. So we have to put in dual-support so that you can choose between Visifire and C1 (where equivalents are available). Visifire V2 didn't have radar charts and gauges, but they do now in V4, possibly invalidating the purchase and migration to C1. What timing eh?! I just noticed that Visifire V4 charts have the text Visifire Trial Edition in the top right corner and the download page says it's a 30 day trial edition. I can't tell if it actually expires after 30 days or if it's just a legal warning. In V2 there was a property to change or hide the text and I have the source code. V4 developer licence(s) cost from $400 to $2500 and there is no free version any more. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Dynamic assembly loading
John, you've mentioned some interesting subjects that I am not familiar with: application library caching and exmap; C1 XAPOptimiser. I'll run some searches on these topics. Loading by navigation might be overkill for my needs, but I would have tried to implement something like if I had complex app navigation. This app has only a handful of fixed screen views that you can jump between. I would urge myself (and everyone else) who is starting a new Silverlight app to remember right from the start that you might need to dynamically load bits of the app ... data, resources, assemblies, etc. Don't be lazy at the start, remember to bake-in some design so you can do this easily. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
404 downloading DLLs
Folks, after finding the reference workaround last night to allow me to keep DLLs out of the XAP, I stumbled across a new problem... On my development machine my background loading of the DLLs is working nicely. When I deploy the app to my server it fails, but it took me hours to find out why. It turns out that the OpenReadCompleted handler is reporting an Exception, which killed my logging code and the error was not being logged. In desperation I put a throw inside the SL4 code and this finally caused an error in the browser and I could click the icon and popup the details. The details say NotFound (what a surprise!!), but at least it told me that a file load failed. I fire up Fiddler and I see the following: So I'm getting a 404 on some DLL files, which I know are present. I tried reading a ZIP of the DLL and it works okay. I presume therefore that there is a configuration difference between my Win7 dev machine and the Win2003 server. I seem stuck in a Catch-22 ... It's not safe to allow IIS to serve DLL files on my server and I presume IIS is stopping this, but all of the samples I've seen do get DLL files from IIS. So how come it works on Win7 but not and Win2003, and what do I do? Surely I can't be the only person who has hit this problem. Maybe I can download ZIPs or XAP file containing the DLLs instead?! Greg image002.png___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: 404 downloading DLLs (solved?)
For the moment my workaround is to async Read ZIP files from the web server, unzip them on the SL client side and add them as assemblies. This is working on my Win7 dev machine and the Win2003 server. Luckily C1 supply a class to make unzipping quite easy. I also found out why my error logging was vanishing ... deep inside the code where I send a buffer of logging objects to the web server I found I was attempting to serialize an Exception (actually a WebException), which threw an error in the error logging, which was then swallowed and vanished. So don't attempt to stupidly serialize core CLR objects back to the full CLR server. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Dynamic assembly loading
Folks, after years of avoiding the need, I finally have to async load some large DLLs. I have two charting libraries to reference and their total size is causing slow app loading. I have placed the guilty DLLs in the ClientBin folder and I can see them async loading correctly. But ... how do I let them be referenced in the project for compilation, but keep them out of the app XAP file for deploy? I tried setting Copy Local = false for the two references, but that has no effect. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Dynamic assembly loading
I guess that means I'm not spamming the list with my posts then *grin*. You could be kind to the colour blind and change your font ;-) -- Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Dynamic assembly loading
Colin, I also suspected some sort of domino effect of dependencies was causing my DLLs to stay included in the XAP. I'm sure my DLLs are only referenced in a single project, and that project has Copy Local false. I moved the DLLs to a separate folder and referenced them there instead of under C:\Program Files (x86) as Copy Local false. I cleaned everything, ran msbuild verbose and had a look at the output. The output is contradictory. It says it found the DLLs in my folder and correctly says they a copy local false. Later it says it will copy the files from the Program Files folder and then it gets included in the xap. There is some influence over the build that I can't detect, possibly taking references from the Program Files folder when I don't expect it to. Oh well, there goes another 5 hours of mostly unpaid work. Everything doesn't work -- Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Excluding DLLs from XAP
I've changed the topic, as this is the real problem. Advice everywhere says that Copy Local = false will prevent the DLL from inclusion in the XAP, technically this is true, but it's not that simple. I can now see that I'm having trouble because my projects are not like the childishly simple ones you see in samples and videos. Although I reckon it's still quite simple with project dependencies originally like this: Foo.App ref - Foo.Controls (Copy Local true) ref- C1.Silverlight (Copy Local false) ref- C1.Silverlight.Chart (Copy Local false) ref- C1.Silverlight.Extended (Copy Local false) ref- C1.Silverlight.Gauge (Copy Local false) None of the C1 DLL files appear in the Controls bin output folder, so I know Copy Local false is working in that project. However, in the App bin output I can see the Controls DLL and all four of the C1 DLLs. From there I presume they get included in the XAP. The stupid workaround is to add unneeded C1 references with Copy false to the parent App project. So the fixed solution now looks like below. Greg Foo.App ref- C1.Silverlight (Copy Local false) ref- C1.Silverlight.Chart (Copy Local false) ref- C1.Silverlight.Extended (Copy Local false) ref- C1.Silverlight.Gauge (Copy Local false) ref - Foo.Controls (Copy Local true) ref- C1.Silverlight (Copy Local false) ref- C1.Silverlight.Chart (Copy Local false) ref- C1.Silverlight.Extended (Copy Local false) ref- C1.Silverlight.Gauge (Copy Local false) ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Event not bubbling up
I also guessed that there must be something different about Canvas and event bubbling, but I can't find anything to confirm or explain this. Now I wonder if there's a way of manually sending the MouseLeftButtonDown event upwards. Any ideas? Greg Keogh ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Event not bubbling up
Can you post a simple repro? No time, as the problem is buried deep inside a gigantic mess of controls and infrastructure. As a workaround I manually raised an event on the click for the parent to listen to. Now I have other stuff-ups to fix and I’ll return to bubbling later. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Event not bubbling up
Jerk no, condescending yes. It was nice of you to write a reductionist app on my behalf, but I never expect anyone to do that (unless they're bored, curious or very charitable). Well, wouldn't it be nice if everyone in this group had enough spare time to perform due diligence and write a test-harness app for every problem they encounter before posting a question about it? Greg Keogh ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Control thumbnails
Shane is a mind-reader. I was looking for the control that auto-sizes its contents in various ways, it's the ViewBox of course. I'll wrap each child in a ViewBox. My parent Grid can have 4 x 4 cells, and in normal display the top visible control will have row and col span 4 with Stretch=None. In tiled mode I'll show all children in a specific cell with Stretch=Uniform. Half an hour later: My experiments show it's starting to work, but there are some strange sizing behaviours like the Viewbox isn't filling the Grid. I'll look at it in the morning with a fresh mind. ADDENDUM: Jack, I received your message just before sending. 'Fluid Layout' is something I'd forgotten about completely. I'd rather go to the dentist than use Blend, but I'll try to figure out what it's doing behind the scenes and see if I can steal the code for a snazzy transition. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Control thumbnails
I have found that it is unreliable to use a Viewbox unless you specifically want the effects it produces. I planned to fill the parent Grid with a Viewbox Stretch=None to effectively turn it off, but there are weird side-effects. Viewbox has a mind of its own about sizing inside a parent. I cannot get a Viewbox to reliably fill a parent Grid. I will therefore have to dynamically rearrange the child controls to place them inside Viewbox inside different Grid cells to get my tiled effect. This is possible, but it's a lot of loops and code and jugging controls around to different parents. I'll think about it... Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Control thumbnails
This question is related to Silverlight and WPF, as I may need to use this technique in both sorts of apps. My app's main Grid parent control can contain different types of child controls that display data in various ways. I internally maintain a 16-deep List of the children, I push a new child onto the top and make it visible, the others are pushed down and hidden and the oldest one drops off the end when it's full. So I effectively have an MRU list of up to 16 child controls available. When the user hits a hotkey I want make all of the children visible and tile them in a nice 4 x 4 arrangement as thumbnails. I'm just not sure what the best mechanism is to achieve this. At first I thought I'd do it manually: centre-position and scale transform each child to create a fake tiled arrangement and maintain it on size changes. Before I do this manual coding, I thought I'd ask for ideas about better techniques. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
[OT] Anti-Football League lunch tomorrow (Melbourne)
Folks, if you're sick of footy fever (or you've got footy fever), consider joining us at the Anti-Football League lunch tomorrow. We'll be at the North http://www.northfitzroystar.com.au/ Fitzroy Star Hotel from midday until around 4pm. It's an informal day of football-free chat, snacks, drinks and board games. I think a few IT people are coming already, but it would be great to have a lot more. See: http://www.orthogonal.com.au/specproj/afl/index.htm http://antifootballleague.org/ http://getalife.com.au/ViewActivity.aspx?Activity_Id=23436 http://getalife.com.au/ViewActivity.aspx?Activity_Id=23436siteref=myrddin siteref=myrddin It's also registered as an event in Facebook somewhere. Cheers, Greg Keogh ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: ASP.NET v4 was prohibited
e.g update to param name=minRuntimeVersion value=4.0.50401.0 / Have no fear, I fell for that once before. So I globally searched and replaced the version numbers in my SL hosting pages. This is easy to forget if you don't use an auto-generated page when you debug. I use specific home page files when debugging, so I have to manually update the SL version when necessary. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Upgrading to Silverlight 4
I've seen this before a bit, but would have had to seen the project layout to confirm what the issue might have been. Apologies for the pain Greg. Ah, don't worry. I didn't keep the before and after copies of the sln or csproj files that might have explained what went wrong and what went right. I was in a hurry and just deleting and adding all 20 references again was the crudest and quickest thing to do. It was hard to remember which controls (Label, DockPanel, etc) are in which DLLs in which folders. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Upgrading to Silverlight 4
Folks, I've just started using VS2010 and I have a Silverlight 3 project that I want to upgrade to 4. I expected to see 4 as a target option in various properties of my project, but I can only see 3. I presume therefore that I have to download all of the developer tools and kits for SL4 myself. Before I start searching I thought I'd check in here first that I'm not wandering down the wrong track. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Upgrading to Silverlight 4
I know the feeling. I had a tough time with System.Windows.Controls.Toolkit myself. I hope it all works out for you in the end. Well it did, but as usual I'm not sure why. I removed all of the dozen references from the project and carefully added them all back one at a time. Suddenly, at some unexpected point I received a clean compile. Now comes the runtime testing. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
SL4 apps not visible
I've just discovered that all of my SL4 apps compiled in Framework 4 and running in a V4 Pool that I created are invisible on my Win2003 server. I have four Framework compiled ASP.NET services and apps that are giving 404. All of the other virtual directories with apps in them are visible as normal to the world. Only my upgraded apps are giving 404. I'm guessing this is an illusion (a lie) caused by security or some obscure configuration step I haven't done. I'm running out of ideas, but I'll keep looking. If anyone has a clue to save my time, please let me know. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
ASP.NET v4 was prohibited
D'oh! The answer came just after I posted my puzzle. After bumbling around all over the place I found that Web Service Extensions node in IIS manager had a new entry ... ASP.NET v4.0.30319 which was set to Prohibited by default. Tricky eh! Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Command binding working
Noobie, I pasted the Command.cs and ButtonBase.cs from Patrick Cauldwell's sample project the into my project and it's working. Thanks for finding that. My previous attempts have used different combinations and versions of these classes without success. This combination does look subtly different to any of my previous attempts. Patrick's code is more primitive than some of the others, so I might try to beef it up and generalise it with the code from other classes. Oh well, my first stupid MVVM hurdle is over, now I have to deal with grid selections, double-clicks, trees, and ComponentOne controls. I will be a challenge to avoid code-behind for all of these cases. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Command binding working
Don't worry too much about eliminating code behinds. Carl, I have decided that having empty code-behind is an academic exercise in elegance that will waste a lot of my time. My policy from today on in SL and WPF is to minimise the code-behind, but only up to the point of comfortable effort. I have a couple of places where child controls are dynamically loaded, try that without code-behind! Making my controls Blendable with mock data is not so important, it's more vital that my controllers be unit testable, and my currently model is okay in that respect. At some point I know things will start to make more sense for you. Everything does make sense (generally), I'm using quite advanced techniques in this SL project, it's just that SL is full of holes and workarounds (ICommand, dynamic styling, globalization for example) and there are too many conflicting tools, articles and sample code. Over the last week I've seen 3 wildly different ways of implementing ICommand and attached properties, and a lot of my time was wasted evaluating them all. I struggle with catastrophic errors, security stonewalls, WCF behaviour complexity, Blend and VS2008 XAML designer failures and assembly bloat, all of which I'd expect in a beta product (is the beta period over yet?). Cheers, Greg Ps. Carl, can you darken your font a bit ;-) ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Invalid XML (addendum)
Can you use an InvokeCommandAction (see the Behaviors category in Blend. That behaviour isn't in Blend 3 and I can't yet find it online or in the gallery - Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Command mystery
I've been using Reflector on the SL3 DLLs looking for assemblies that contain ICommand, Button and ButtonBase in the hope that I will find something to reference in the XAML and solve my broken Blend designer. I've failed, as I can't even Find Button let alone any of the other familiar controls. The weird thing is that putting Command={Binding MyCommand} actually works at runtime, but at design time it says the member Command is not recognised. As usual, nothing makes sense and everything doesn't work. A lot of web references indicate that SL4 will make all of this command binding more natural, but it will be weeks before I can start migrating. I had a look in the SL4 assemblies in Reflector and I can quickly find Button, ButtonBase, ICommand and the rest. I can't find them in SL3. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Command binding and Invalid XML
Folks, I used the instructions on this page to bind Button clicks to controller properties: http://johnpapa.net/silverlight/5-simple-steps-to-commanding-in-silverlight/ It's all working nicely, and I've created a generic version. However, it's killed the blend 3 designer. I just get the dreaded red box with Invalid XML and in the code you can see this: It's nice to have the command binding working, but it's worse to have the designer die everywhere I bind. Any ideas anyone? Greg image001.png___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Dynamic themes and resources
Chaps, I have some news on this subject. After talking to the client go-between on just when they needed in the way of custom styling the SL3 app, it seems that the level of skinning provided by the toolkit themes is way beyond their needs. They need about 6 different major parts of the various major controls customised (the background, the footer, header, etc). They don't need the appearance of all text, combos, list, etc controls customised. I already had the common properties of important controls styled in the App.xaml, so I moved those setters into a class I called 'ApplicationBinder' which exposed the various Brushes and misc custom settings as dependency properties. That binder class is a global resource in the App.xaml so that it was available to all controls. Once that is done, you can dynamically change the brushes and the binding will update the appearance all over the place where the controls are bound. There is no wizardry in this, but it's a reminder of the power of binding. Rather than put global styles in App.xaml, put them in a global resource class that you can bind to from anywhere. You then have an instant lightweight dynamic skinning. I plan to return to the toolkit themes and use them later once I'm on SL4. But using simple binding to a global resource class is a miracle quick fix for now. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
JavaScript possibilities
Folks, my Silverlight 3 app is a lightweight version of a gigantic windows app written in C++, and the authors of that app want my SL3 app to simulate the export facility of its big brother, which sends data to the Clipboard, to a new browser window or to Office apps via automation. I explained to them SL3 is mostly deaf, dumb and blind on the client machine, and as far as I know the only way it can talk to the client is by invoking JavaScript methods. I see that SL4 can work with the Clipboard, but it will be several weeks or more before I migrate up to VS2010, Framework 4 and SL4. I'm already calling JavaScript methods in the browser for trivial purposes, so I can pass huge strings of XML into JavaScript methods as well. I'm not up-to-date with JavaScript and I was wondering if it has any power act as a kind of trusted intermediary to allow the SL3 app to send XML to the Clipboard, browsers or automated Office apps. Has anyone done this sort of thing? In the meantime I'll keep web searching for articles on this matter. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Dynamic themes and resources
Folks, it's an action-packed day, I just received word that my SL3 app will soon need to have a feature to assign a different appearance and different string resources according to who is authenticated (via the initial login screen). I took precautions to allow the app to have a different appearance and strings in different installations, but I wasn't really prepared to cater for the more granular approach of changing appearance for different logins. The strings are all in a spreadsheet-style resource file, so that's only a minor problem for me. However, dynamically changing themes is more frightening as I haven't needed to do that before. I've tried to be neat with my styles and put them in the controls or in the App page, but I feel that to get dynamic themes in Silverlight I will have to be ultra-strict and use clever binding. I'm just not sure of the best way to structure the styles and templates globally within the app to make theming easier. I'm going to search to web article guidance on this, but I'm keen to hear from anyone who's done this before and has some tips and tricks to share. Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Lots of bind/notify classes
Chaps, I have decided that snippets are the quickest way out of this at the moment. It doesn't modularise or reduce the property code, but at least it means I can create them faster. Actually, I forgot how good snippets are. For some reason I neglected them for the last couple of years, now I'm all invigorated about them again and I'm building my own fresh collection. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Long running animation
Coincidentally, I woke up early this morning and I decided to do some mental health coding. Just for fun I expanded my proof of concept app from last week to animate more elements and have some configuration controls for size, counts and speed. I'm pleased with the great animation effect produced by a relatively small amount of core code. Imagine how far you could take this and create some really mind-boggling animations with perspective 3D, shading and complex shapes. http://www.orthogonal.com.au/computers/hypno/index.htm Cheers, Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Dynamic creation of Accordion items crash
The following code crashes on the highlighted line with catastrophic failure 0x8000. All I'm doing is looping to create items for an Accordion control. It's just dying when I assign the (non null) Style to the second Textbox. Anyone tried this sort of thing before? - Greg Style x:Key=ItemHeaderTextStyle TargetType=TextBlock Setter Property=FontSize Value=16/ Setter Property=Foreground Value=Black/ /Style Style x:Key=ItemContentTextStyle TargetType=TextBlock Setter Property=FontSize Value=12/ Setter Property=Foreground Value=Gray/ Setter Property=Margin Value=12,8,8,8/ Setter Property=TextWrapping Value=Wrap/ /Style [cut] accordNavigate.Items.Clear(); string[] titles = new string[] { Labels, Cells, Significance, Titles, Vectors }; for (int i = 0; i titles.Length; i++) { AccordionItem item = new AccordionItem(); TextBlock headerText = new TextBlock(); headerText.Text = titles[i]; headerText.Style = (Style)this.Resources[ItemHeaderTextStyle]; item.Header = headerText; TextBox contextText = new TextBox(); contextText.Text = string.Format(This is the content of accordion item No.{0}, i + 1); contextText.Style = (Style)this.Resources[ItemContentTextStyle];; item.Content = contextText; accordNavigate.Items.Add(item); } ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Dynamic creation of Accordion items crash (solved)
It was an intellisense induced error. The second TextBox should have been a TextBlock. I was applying a style intended for the wrong type, bu tcouldnt see it for looking. Great error message eh!? --Greg Style x:Key=ItemContentTextStyle TargetType=TextBlock [cut] for (int i = 0; i titles.Length; i++) { AccordionItem item = new AccordionItem(); TextBlock headerText = new TextBlock(); headerText.Text = titles[i]; headerText.Style = (Style)this.Resources[ItemHeaderTextStyle]; item.Header = headerText; TextBox contextText = new TextBox(); ß WRONG contextText.Text = string.Format(This is the content of accordion item No.{0}, i + 1); contextText.Style = (Style)this.Resources[ItemContentTextStyle];; item.Content = contextText; accordNavigate.Items.Add(item); } ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Images invisible
Late last night I was working away on my SL3 app doing the compile-run, compile-run thing over and over as usual. Without warning the app fired up and all of the images were blank. And by blank I mean invisible. All 61 images in the solution seems to be taking space on the screens, but are invisible/blank. There are no loading errors or JavaScript errors or any warnings of any kind. I deleted all binaries and rebuilt everything. I've rebooted this morning and rebuilt everything. I tried to use Fiddler2 to see if there were any silent 404s, but it won't trace localhost (there are dozens of pages of instructions on how to do this, but they all are nonsensical or don't explain where the settings are in Fiddler2 to allow this). I have never seen anything like this in my life, and I never would have guessed such a thing was possible. I would have been less surprised if my machine sang the national anthem when I ran the app. I've already wasted 2 hours on this, so I thought I'd mention it anyway just in case someone has seen the symptom before. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Images invisible (addendum)
The invisible images problem only happens on my dev machine. I copied the whole solution to my live web server and loaded it in IE8 via IIS and it looks normal. Is it something to do with running it under the Visual Studio Development Server on port 55310? That's the way I've been running it for the last 18 months. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Images invisible (SOLVED)
Stephen, I own you a bottle of champagne, as you accidentally pointed out what was wrong with my project. Why was it using the file system I don't do that, I prefer to use HTTP as it's more realistic. I didn't notice the file system path in the web browser. So sometime over the last couple of days, some configuration of my project has changed, some defaults I dunno what, but by carefully putting all my project settings back according to those of another working SL3 project it has come good. VS has been crashing a lot, and I had to purge all the hidden solution files recently, so that's probably broken my defaults. So it couldn't load the images because I was running from the file system. There's a warning for you!! Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Long running animation
Folks, I want to create a sort of screen saver effect where a shape moves slowly around a control. The path it follows is calculated at start time by mixing random Sin/Cos functions, then the shape will follow the (x,y) coordinates of the function over time. It's like a moving parametric plot. I'm just not sure what coding technique to use for this effect. I'm guessing I'll need a frame-based animation, which I've never used before. It looks like it pushes events to you and you respond and move your elements, but it's not clear how you control the timing. I just want to run this idea past someone who's done it before and can confirm if I'm on the right track or not. I'll keep reading about frame-based animations in the meantime. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Long running animation (answered)
A quickie demo app to show the answer to my question. http://www.orthogonal.com.au/computers/silvertest I've put a note on the page to say that Frame-Based animation works nicely for my purposes. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Invalid or malformed application
Enable Silverlight debugging in your web app, at least then you can see which control is causing it (will break in visual studio) Nah, it wasn't getting that far, and debugging was all on. The app xaml wasn't loading and I got not useful diagnostic clues anywhere. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Simulating modal dialog
Can anyone recommend a Silverlight way of simulating the effect of a Windows model dialog? Or perhaps it's not wise to attempt this at all and use some other UI technique. I have seen a few demos over the last year or so, including one by Stephan Dekker last January on the SL weekend where put a semi-transparent canvas over the main app window to create a dialog illusion. I think I've seen Jordan Knight do the same thing at a demo last year. I heard discussion that these techniques are not watertight because they're not really modal and don't block keystrokes. I'm using the Liquid controls, and they seem to contain a Dialog class. I'm going to take a couple of hours to play with the Liquid Dialog, but in the meantime I thought I'd ask about this subject in general. Cheers, Greg Ps. I've put the context menu into the too-hard-basket for now. I'll return to it later when I have more hobby time, or SL4 arrives with one. ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
XAML editing crash (2)
Many web searches indicate that there possible issues with the Toolbox or Power Commands and VS2008 SP1. There are other less credible workarounds, but I'll slowly work my way through them until I find the answer. I'll let you know if I might luck upon anything of global importance. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Invalid or malformed application
I've just spent 2 hours creating a control and pulling out common styles from multiple controls by putting them in an external merged dictionary XAML file. It's the first time I've used a merged dictionary, and it's damn good way of keeping your resources tidy. However, sometime during the last hour I've broken something and my app won't load or start. I get the following: Microsoft JScript runtime error: Unhandled Error in Silverlight 2 Application Code: 2103 Category: InitializeError Message: Invalid or malformed application: Check manifest I am dead in the water, unable to find the cause. While I keep stuffing around hopelessly, I thought I might as well ask if there is some trick anyone knows to help locate the problem. I uselessly tried backing out some of my changes, but that could take twice as long as actually writing the code in the first place. I tried removing the merged dictionary but it does nothing. This is progress?! Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: Ragged ListBox item widths
ListBox ItemTemplate={StaticResource ItemTemplate} ItemsSource={Binding Collection} ListBox.ItemContainerStyle Style TargetType=ListBoxItem Setter Property=HorizontalContentAlignment Value=Stretch/ /Style /ListBox.ItemContainerStyle /ListBox THIS WORKS! I was afraid that the Border around the Grid would ruin the stretching, but it works anyway. Thanks for that. I'm happy to remove the event code I posted yesterday and use the Setter instead. I'm always happy to remove code. Because you asked, below is my ListBox definition. Greg ListBox x:Name=listJobs BorderThickness=0 IsEnabled={Binding HomeBinder.IsNotBusy, Source={StaticResource binders}} Visibility={Binding HomeBinder.ListVisible, Source={StaticResource binders}} ItemsSource={Binding HomeBinder.JobItems, Source={StaticResource binders}} ListBox.ItemContainerStyle Style TargetType=ListBoxItem Setter Property=HorizontalContentAlignment Value=Stretch/ /Style /ListBox.ItemContainerStyle ListBox.ItemTemplate DataTemplate Border x:Name=bordItem CornerRadius=0 BorderThickness=1 BorderBrush=#FF66 Grid x:Name=gridItem Grid.RowDefinitions RowDefinition Height=1*/ /Grid.RowDefinitions Grid.ColumnDefinitions ColumnDefinition Width=65 / ColumnDefinition Width=* / /Grid.ColumnDefinitions Grid.Background LinearGradientBrush EndPoint=0,0 StartPoint=1,1 GradientStop Color=#FFE0E0E0/ GradientStop Color=# Offset=0.5/ /LinearGradientBrush /Grid.Background Image x:Name=imgItem Width=50 Stretch=Uniform Grid.Column=0 Source={Binding Converter={StaticResource ItemConverter}, ConverterParameter=1} HorizontalAlignment=Center VerticalAlignment=Center/ StackPanel x:Name=stackItem Orientation=Vertical Grid.Column=1 HyperlinkButton x:Name=linkItemResComment Margin=0,0,10,0 Content={Binding Converter={StaticResource ItemConverter}, ConverterParameter=5} Style={StaticResource ItemSelStyle} Click=linkItemResComment_Click IsEnabled={Binding Converter={StaticResource ItemConverter}, ConverterParameter=6} Tag={Binding Converter={StaticResource ItemConverter}, ConverterParameter=10} HorizontalContentAlignment=Left / TextBlock x:Name=textItemResName TextWrapping=Wrap Margin=0,0,10,0 Text={Binding Converter={StaticResource ItemConverter}, ConverterParameter=3} Style={StaticResource ItemNameStyle}/ TextBlock x:Name=textItemResCreated TextWrapping=Wrap Text={Binding Converter={StaticResource ItemConverter}, ConverterParameter=2} Style={StaticResource ItemCreatedStyle} Foreground={Binding Converter={StaticResource ItemConverter}, ConverterParameter=4} Margin=0,0,10,2/ /StackPanel /Grid /Border /DataTemplate /ListBox.ItemTemplate /ListBox ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Mouseclick in ListBox
Folks, I have a bound ListBox with a template that makes the items appear pretty with an icon and some text boxes. I want to trap a mouse click anywhere in one of the list items. The mouse may of course click on one of the controls in the item's template. I'm not interested in where the mouse is clicked, I just want to know which item it's inside. I've been playing with mouse click events and similar tricks, but no events are being raised. Am I missing some simple technique for this? Thanks Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Intenet Explorer (64-Bit)
I just had an email from a tester of our Silverlight 3 app that Microsoft Silverlight cannot be used in browsers running in 64 bit mode. This Web browser or operating system may not be compatible with Silverlight. I never even noticed that a 64 bit IE existed until he pointed out that he's got this on his start menu: cid:part1.09030205.09090702@redcentresoftware.com I don't think he really noticed either, but in the meantime we've told him to ignore the 64 bit browser. I'm just wondering if anyone knows any gossip about the future of 64 bit browsers and Silverlight. Greg image001.jpg___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: App loading speed
Hi Asheesh, My first test of moving the images to site of origin worked nicely, as no code changes are needed. The XAP file reduced from about 2MB to 800KB and you can feel the loading speed improvement. However, I have noticed that some later controls load more slowly first time as new Tree control images are loaded. This seems to be a trivial problem though. I forgot that MEF now gets parts from XAPs. I'll read the documentation on that feature. Thanks Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
XAML Intellisense lost
Folks, after rebuilding my Win7 PC with Visual Studio 2010 and all of the Silverlight dev kits and tools I have found that the XML/XAML intellisense has vanished from Visual Studio. The XML/XAML is now as dumb as plain text. Does anyone know how to get my intellisense back again? Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: XAML Intellisense lost
Could it be this issue on Scott Guthrie's blog? http://weblogs.asp.net/scottgu/archive/2010/02/11/intellisense-crashing-fix- for-vs-2010.aspx Nah, I'm not getting any crashes or errors. The intellisense is just dead no matter if I open it via the WPF Designer (Default) or the XML edit, with or without encoding. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: XAML Intellisense lost
I have found that the problem of the missing intellisense is intermittent. It will occasionally start working again, but not very often, and I can't find any pattern yet behind what's going on. Surely I'm not alone in having a Silverlight/WPF designer in Visual Studio 2008 what is broken to hell and back. Besides the mostly broken intellisense, opening XAML in the designer causes Visual Studio 2008 to randomly and frequently crash completely with the Send or Close dialog. It will not response to the Close button and I have to kill the devenv.exe task. If VS2008 restarts and the XAML file was the last one open, it will attempt to reopen it and crash immediately. I have to manually delete the *.suo files and restart Visual Studio. Ignoring the fact that the designer doesn't actually design anything at all -- it's just a XAML editor -- the highly unstable experience makes developing Silverlight in Visual Studio a living hell and nearly doubles my development time. At Code Camps and evening SIG meetings I never hear anyone complain about these sorts of issues. I was wondering if the experience was better in Visual Studio 2010 RC, but when I created a new Silverlight project it crashed immediately before even loading the solution. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight