Item not showing in +CLR Object?

Posted on

There was quite the high level of frustration.

Chapter 12, after the section regarding Dependency Properties, you go over a case study which is… exactly the same exercise which was done at the tail end of chapter 9.

The part which I ended up skipping over as I could not get my new class to even show when clicking to add a CLR object – the actual project itself wasn’t showing at all, just the system resource classes.

The first time we did this, at the end of Chapter 9, I spent a good 2+ hours trying to discover the source of the issue – why wasn’t it showing?!  I downloaded the example provided on the book’s website and compared the C# from that with my code and they appeared to have no differences.  I knew that this would likely be something that I would either spend more hours looking at and be a case-study for einsteins theory on insanity (doing the same thing over and over again expecting different results) or if I was smart, I’d just move on and come back to it.

Well chapter 12 has us coming back to it and I experienced the same issue.  3DImageProject was not showing even as an asset to be searched in the “Add CLR Object Data Source” menu.  The only items showing were the system and presentation resources.

Oh man.  My heart sank very low.  I thought for sure this time it would work and that I’d just have to do the prevous one over again – but nope.  This one didn’t work.  Which told me 2 things.  1) The first time through I very well may have done it completely right, and 2) There might be an additional step which I need to take between the switch from Visual Studio and trying to add the CLR through Blend.

I started looking around and a thought came to mind.  Sometimes when I’m working between various documents within Visual Studio where the documents reference each other, Visual Studio won’t notice the existance of the link properly until after hitting F6 to build.  Then the notification squiglies discontinue their plague and I can continue on without issue.

Now, just before moving from Visual Studio to Blend, I did build the application, but perhaps Blend itself wasn’t associating everything.  So I decided to use Blend’s “Build Solution” (ctrl+shift+B) and try from there to add a new CLR and guess what… IT WORKED!!!

Shiny buttons and Blend's interface options

Posted on

I’m going through chapter 11 of Victor Gaudioso’s book on Expression Blend 2, and he is stepping his readers through the creation of a glassy button.

I’ll summarize what we’ve done so far.

First, we created a rectangle with beveled edges.  He directs his readers to use the visual controls to create the curve.  I prefer to have a bit more control over it, and so I enter into the properties pane in the RadiusX and RadiusY.  Either way works.

He then instructs the readers to duplication this – or in Blend 2 terminology, its a simple copy-paste (Photoshop!  Get out of my brain!), shrink the size of the rectangle, set both gradient stops to white (#FFFFFFFF) then turn the right-most gradient stop’s Alpha channel to 0%.

I’ve seen people do this in 3 ways.  Either by clicking and moving the mouse up/down or left/right (its somewhat like a dial – click and drag will increase or decrease the percentage), type directly in the 100% field to the prefered modifier, or by programming it directly in the color code.

A bit on that last option, you may notice that the color code has 2 more characters than usual.  I promise, that is not a typo.  The addition of the 2 are specifically related to the Alpha chanel, and those are placed as the first 2.  Most colors will remain solid.  So if you’re modifying color hex by hand, just pay attention to the last 6 and ignore the first 2.  If you’re wanting to adjust the alpha and change it to 0%, just replace the first to FFs with zeroes.  The result will be this: #00FFFFFF

This will often help when you’re neck-deep in XAML and don’t want to switch to design view.

The last thing I wanted to mention was the use of the white gradient – to – 0% alpha.  This is a commonly used thing for designers who work in photoshop or illustrator with one exception – the “layers” are exactly the opposite.  Instead of the top item being “on top” its more like painting – you start with the backing and for each additional color, you add to the existing one.  I had to “reprogram” the way I thought about these orders and because I move between photoshop and blend, it continues to throw me off.

In blend, the bottom-most object is the one in the forefront.

So the shiny button, I’ve described the first 2 layers – the base gradient, and the shine which has been shrunk and has had half of the gradient modified to being transparent.  The 3rd step is to take the resized 2nd layer, duplicate it (copy-paste) and then flip it.

Victor (the author) has you go into the properties pane to the bottom and transform it by rotating by 360º.  I prefer using the last tab which will exactly flip it either vertical or horizontal.  This being so similar to a tool that I use QUITE frequently in photoshop – this is much more comfortable for me to use than a full 360º rotation.  From there, you just need to hit the down arrow a few times to make this 3rd rectangle closer to the bottom.

The result is something like this:

Not too bad – working with Blend is really not all that different than working with Illustrator or Photoshop, but the differences can be tough to overcome at first.  Blend is a whole lot more like Illustrator than photoshop in the matter that you’re dealing with vector based images and can modify things like the bevel radius on the fly – after its been put onto the canvas.  In photoshop, its not really much trouble, but you do often end up having to just delete a layer or an object and add it back on if the radius on a vector(path) based image isn’t quite right.

Rotaty 3d playing media player

Posted on

I just completed Chapter 10 and am thinking back a bit.

Just a few days ago, I was not exactly uncomfortable with tinkering with the C# but I very much was not anywhere close to the level of comfort that I have now, and like a battle scare that one is proud of, I’m proud of something I’m already noticing that I do incidentally that I kick myself over – a bad habit beginning to form.  Habits only begin to form when you’re used to doing something over and over again.

The bad habit?  Putting quotations where I know they need to be there.  Now why is that bad?  Because Visual studio does it for me, so I end up having something that looks like this:

Height=””28″”

I then have to stop in my train of thought, backtrack, and fix it.

Ahh… progress.

On a personal note, the only reason I’m even able to scream through this book as quickly as I am is because the last day of 2008, our water heater broke.  Someone has to be here for those who are far more capable of taking care of that situation than me – which means I’m home from work and instead of sitting on my hands or picking my nose, I decided to finally start going through this book – one which has been begging me to go through it for months.

Tomorrow, they fix the water heater.  I wonder if I’ll actually get through to chapter 15 by the end of tomorrow?  I’m just now starting chapter 11 and… its 3:30am.

YAY!

Posted on

I don’t know if its the lack of sleep, the non-stop pouring over this book, or the fact that I need coffee, but I just got to one of the last projects for chapter 10 (there are 3 or 4 of them) and I’m seeing the direction to name a Media Element the name of “ME”.

I saw that and started internally jumping up and down.

Why?

Because I’m crazy!! … and because I’ve seen that this was a major discrepancy that entirely breaks part of the application a few pages from now. The author, Victor Gaudioso (are you as used to reading the name as I am to typing it?), has in a page dedicated to book updates, the bold letters regarding this flaw.

Not sure why – but I feel as though I just “Dinged” in levels by reaching this point (for those of you who are not gamers, that’s a common phrase used among MMOers who increase in level of skill. Quite often, the game will let off a “DING!” coupled with particle effects and text in some form or another which tells you that you’ve increased in skill/level/whatever.).

Update: Now I’m a complete retard.  I was mistaking this naming for the other.  The other was a section which I had to skip to come back to as I couldn’t get it to behave in the way specified and instead of sitting there going back and forth like a mad person comparing over and over and over again until my eyescrossed, I decided to move on and hope that my abilities and proficiency has improved enough to be able to notice the error.

Convoluted explanation.  You could have just stopped at the sentence, “Now I’m a complete retard.” and you would have been good.

WPF Flyby – a YouTube video demonstration

Posted on

This thing that I’ve been talking about all day which has been driving me up the into a wall is finally in a state that is viewable.

Its a basic set of 3D text and a shape, neither of which is “rendered” in the way that many are used to when thinking of using 3D modeling tools, instead, its been kept somewhat raw but in an interesting way – its all kept as code – XAML to be exact.  It includes environmental factor code to allow for lighting and color variations when the text “interacts” with the lightsource.

I don’t know enough to know if it can be used in a way where multiple sources of light are present, but at this point, I’m pretty impressed at the power of XAML.

The below video is a camtasia recording of the “application” such as it is.  The button is set up, not with a trigger to start (which could have easily been set), but by a c# method.

The only thing that I would do differently is to have the button reset the storyboard to 0 (zero) on mouseDown which should allow for the storyboard to “rewind” and replay.

I’m wondering if it would be something where it would detect the place of the animation – such as  if the storyboard is greater than 0, then reset to 0.

I’m digging around google and have posted on the WPF MSDN forums to see if I can find an answer.

Anyway, here’s the video:

Ok, that hole was painted on that wall

Posted on

It wasn’t a real hole – it was a well painted brick with great perspective – I’ll just walk around the wall.

The program which I was using unfortunately wasn’t spitting out the xaml for the entire thing that I was viewing. It had the perspectives and the object and its name, but none of the factors regarding angles, colors, shades, textures, or any of that.

So I resorted back to just using what Victor gives in his example on his website and have played around with that. Since I wasn’t able to create the objects, I figured I should at least work for it – right?

So I went through the xaml and hand-changes the aweful red/brown/pink color that his “WPF” was at. At least he’s going w/ the theme presented by the cover this time.

So I modified the “WPF” and turned it into a nice shiny blue but retained the gold hoop which is behind it.

Here’s the fun part – now that the 3D element has been created, I can modify it in Blend. The 2 objects can either be modified as a unit or individually, and that’s QUITE a lot of fun.

So I’m somewhat going outside the boundries of this chapter. Not by much, but a little. Its fun to see what “this button does”.

Anyway, when I have the entire exercise completed, I’ll camtasia it for all of you viewing the blog and put it up on youtube. 😀