Creating a WPF / Silverlight Control With a Semi Transparent Backgroun(dev102.com)

submitted by razamitrazamit(4566) 3 years, 3 months ago

Yesterday I was trying to create a control with a partially transparent background,. I am writing this because what I thought was so straight forward, was not.

7 comments |category: |Views: 241

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by vidalsasoonvidalsasoon(0) 3 years, 3 months ago 0

do not follow this person advice. they skipped the chapter on using layouts properly.

Reply

posted by razamitrazamit(4566) 3 years, 3 months ago 0

You are aware that the code examples are only for making a point and to show an example.

Reply

posted by vidalsasoonvidalsasoon(0) 3 years, 3 months ago 0

<Grid>
<Label Margin="57,101,21,101">hiding behind everything</Label>
<Grid Opacity="0.5">
<Border Margin="57,61,21,101" Name="border1" Background="blue" />
<Button Height="23" Margin="94,103,109,0" Name="button1" VerticalAlignment="Top">Button</Button>
</Grid>
<Rectangle Width="50" Height="50" Fill="Pink" ></Rectangle>
</Grid>

Reply

posted by razamitrazamit(4566) 3 years, 3 months ago 0

The whole point was that the Rectange is inside the Border to simulate a "hovering" semi transparent control above everything, and that you can set opacity for brushes. I could have shown endless example like the one you gave.

Reply

posted by vidalsasoonvidalsasoon(0) 3 years, 3 months ago 0

Take it easy. There's just too many noobs writing blog articles and it can create problems for other noobs learning (I was a Silverlight noob just 6 months ago...). Your blog was trying to show unexpected behavior when it was in fact completely expected. You found a solution but it was the wrong one.

I had the same problems with layouts as you learning this stuff initially.

Reply

posted by razamitrazamit(4566) 3 years, 3 months ago 0

Dont worry I am taking it easy, it is just rude to write what you wrote without even taking the time to understand what I was trying to explain.
I dont think anyone of us gave a solution cause there was no problem, my whole point was to show that opacity can be set on brushes so only the BACKGROUND of whatever you want will be transparent.
There is no Layout involved here, and even so, there are so many options in WPF and there are almost no "Wrong" solution, every solution has its ups and downs. I would love to hear you to try and explain why your so called solution is better than mine.

Reply

information Login or create an account to comment on this story