XAML

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi, i have just installed VS2008 and was working on a simple WPF
application.

I created the following XAML, it produced a simple rectangle with a
reflection at the bottom. When i run the app, it looks totally
different from when it was in the designer? Why?

<Window x:Class="Reflection.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
xmlns:r="clr-namespace:Reflection"
Title="Reflection" Height="500" Width="500">
<Grid>
<StackPanel HorizontalAlignment="Center" >
<Canvas x:Name="canvas" Width="478" Height="231">
<Rectangle Fill="Black" Width="50" Height="50"
Canvas.Left="143.75" Canvas.Top="108.75" />
</Canvas>
<Canvas Width="478" Height="231">
<Rectangle Width="478" Height="231">
<Rectangle.Fill>
<VisualBrush Visual="{Binding
ElementName=canvas}">
<VisualBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform CenterX="0.5"
CenterY="0.5" ScaleX="1" ScaleY="-1"/>
</TransformGroup>
</VisualBrush.RelativeTransform>
</VisualBrush>
</Rectangle.Fill>
<Rectangle.OpacityMask>
<LinearGradientBrush StartPoint="0,0"
EndPoint="0,1">
<GradientStop Color="#44000000" Offset="0"/

<GradientStop Color="#00000000" Offset="1"/

</LinearGradientBrush>
</Rectangle.OpacityMask>
</Rectangle>
</Canvas>
</StackPanel>
</Grid>
</Window>
.



Relevant Pages

  • RE: WPF vs WinForms
    ... The primary advantage to it is that it doesn't sit on GDI like WinForms, ... WPF apps have a logical tree (of buttons, grids, ... Give us a Menu that you don't have to edit in Xaml. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: WPF vs WinForms
    ... The primary advantage to it is that it doesn't sit on GDI like WinForms, ... WPF apps have a logical tree (of buttons, grids, ... Give us a Menu that you don't have to edit in Xaml. ... But the designers will be people adopted from the ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: WPF Allgemeine Erfahrung
    ... sonstiges optisches Zeug in XAML zu notieren, aber bei Events, Code, ... Vererbungen, ... Ich bin zur Zeit dabei mich in die WPF ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Test a XAML in XP, service pack 2
    ... Someone I know who teaches a WPF class said xaml ... And it's a WPF application itself. ... Robin S. ... Even my machine experienced one automatic window update ...
    (microsoft.public.dotnet.framework)
  • Re: WPF vs WinForms
    ... The dynamic way to "create controls out of controls" ... VS2008 gives poor intellisense when working in XAML and the lack of a visual designer that really worksis embarrasing. ... The MSDN help is also very poorly written for WPF, few examples- the help text on the classes is many times just one line. ... WPF is good when dealing with media rich applications, dealing with few controls - but for us working with more business type of apps it doesn't cut it! ...
    (microsoft.public.dotnet.framework.windowsforms)