Today I have encourted something weird, which has never happened to me, and I didn't experience it anywhere before.
So let me go intol the detail, My friend have made a Photoshop Image with layers, which, I'll use to make him a software, but, when I try to add like layers 1 by one on a wpf app, and after fixing the aspect ratio by using the Stretch thingy, I have found out that it doesn't look exactly like the original picture in Photoshop, like, I have put all the layers, each one seperated of course, because, later I'll interact with them, let me show you some images.
but it still looks like there's some pixels missing and the text is not showing correctly.
This is the program interface:
This is the Photoshop image:
And this is my XML code:
<Window x:Class="OlympusSimple.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" ResizeMode="NoResize" WindowStyle="None" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="400" Width="800">
<Grid>
<Image Height="400" HorizontalAlignment="Left" Name="BackgroundUpbarBlur" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/BackgroundUpbarBlur.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="BackgroundUpbar" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/BackgroundUpbar.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Olympus" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Olympus.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Upbar" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/UpBar.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Minimize" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Minimize.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="FullScreen" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/FullScreen.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Close" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Close.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="SelectFile" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/SelectFile.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="SelectDestination" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/SelectDestination.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="ButtonDiscordUnready" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/ButtonDiscordUnready.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="RestoreAll" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/RestoreAll.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Tutorial" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Tutorial.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Twitter" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Twitter.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Patreon" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Patreon.png" Margin="0,0,0,0" />
<Image Height="400" HorizontalAlignment="Left" Name="Discord" Stretch="Uniform" StretchDirection="Both" VerticalAlignment="Top" Width="800" Source="/OlympusSimple;component/Images/Discord.png" Margin="0,0,0,0" />
</Grid>
I've searched and didn't find anything that could lead me to a solution, so if anyone can help me it'll be greatly appreciated.
Related
I need to draw on canvas using a few brush patterns like "Paint" in Windows OS.
I need "oil brush" and "pastel".
As I understand, it's possible via VisualBrush.Visual (Canvas with vector paths).
<UserControl x:Class="DrawingToolbar.DTBrushParamsContainer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DrawingToolbar"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="395" d:DesignWidth="500">
<UserControl.Resources>
<VisualBrush
x:Key="OilBrush"
TileMode="Tile" Viewport="0,0,10,10"
ViewportUnits="Absolute" Viewbox="0,0,10,10"
ViewboxUnits="Absolute">
<VisualBrush.Visual>
<Canvas Width="495.9968" Height="66.6656" ClipToBounds="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
</Canvas>
</VisualBrush.Visual>
</VisualBrush>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="55" />
</Grid.RowDefinitions>
<xctk:ColorCanvas x:Name="colorCanvas" Grid.Row="0"
Background="Transparent"
Height="145" Width="237"
UsingAlphaChannel="False" Margin="0,27,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Label Content="Цвет кисти:" HorizontalAlignment="Left" Height="27" VerticalAlignment="Top" Width="82"/>
<Label Content="Толщина кисти:" HorizontalAlignment="Left" Height="27" VerticalAlignment="Top" Width="103" Margin="242,176,0,0"/>
<Slider x:Name="brushSizeSlider" HorizontalAlignment="Left" Margin="242,203,0,0" VerticalAlignment="Top" Width="237" Maximum="100"/>
<Label Content="Прозрачность цвета кисти:" HorizontalAlignment="Left" Height="27" VerticalAlignment="Top" Width="179" Margin="0,176,0,0"/>
<Slider x:Name="transparencySlider" HorizontalAlignment="Left" Margin="0,203,0,0" VerticalAlignment="Top" Width="237" Maximum="255"/>
<Label Content="Стиль кисти:" HorizontalAlignment="Left" Height="27" VerticalAlignment="Top" Width="103" Margin="242,0,0,0"/>
<RadioButton x:Name="normalBrush_rb" Content="Обычная кисть" HorizontalAlignment="Left" Margin="242,27,0,0" VerticalAlignment="Top" IsChecked="True"/>
<RadioButton x:Name="oilBrush_rb" Content="Кисть для масла" HorizontalAlignment="Left" Margin="242,77,0,0" VerticalAlignment="Top"/>
<RadioButton x:Name="pastelBrush_rb" Content="Пастель" HorizontalAlignment="Left" Margin="242,127,0,0" VerticalAlignment="Top"/>
<InkCanvas x:Name="normalBrush_ink"
Background="White"
HorizontalAlignment="Left" Height="30" Margin="242,42,0,0" VerticalAlignment="Top" Width="248">
</InkCanvas>
<InkCanvas x:Name="oilBrush_ink"
Background="White"
HorizontalAlignment="Left" Height="30" Margin="242,92,0,0" VerticalAlignment="Top" Width="248">
<Line X1="10" X2="100" Y1="15" Y2="15" Visibility="Visible" StrokeThickness="5" Stroke="{StaticResource OilBrush}">
</Line>
</InkCanvas>
<InkCanvas x:Name="pastelBrush_ink"
Background="White"
HorizontalAlignment="Left" Height="30" Margin="242,142,0,0" VerticalAlignment="Top" Width="248"/>
</Grid>
</UserControl>
In my app, I need to draw line on canvas with pattern (sample for user) and to draw, using this pattern, by mouse.
Can you help me with drawing, using brush pattern (step-by-step) in xaml and|or programmatically? It can be vector in xaml or image file using.
Brush pattern (.eps)
Brush pattern (.svg)
Source link of brush
Brush pattern (.xaml)
Now, I draw in xaml, using Brush pattern, but this is not oil brush (like in default paint app):
First of all, thank you for taking your time to read this.
Im pretty new to WPF and especially to using MahApps - http://mahapps.com
Im having problems switching between pages that I have created using MahApps in my window.
Here is my starting window (MainWindow):
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:Dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" x:Class="WpfApplication.MainWindow"
xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
Dialog:DialogParticipation.Register="{Binding}"
Title="MainWindow"
Height="600"
Width="800">
<Grid>
<Frame x:Name="Main"/>
</Grid>
Here is the page that I want to move to (I created a frame in the main so I could put the content of this page on it):
<Controls:MetroWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:Dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" x:Class="WpfApplication.MainMenu"
xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
Dialog:DialogParticipation.Register="{Binding}"
Title="MainMenu"
Height="600"
Width="800" NonActiveBorderBrush="#FFC32C2C">
<Grid>
<Image x:Name="Background" Source="C:\Users\User\Desktop\Iddo Work\C#Learning\WpfApplication/teaserBackground.jpg" Stretch="UniformToFill">
<Image.BitmapEffect>
<BlurBitmapEffect Radius="17" />
</Image.BitmapEffect>
</Image>
<Image x:Name="Logo" Source="C:\Users\User\Desktop\Iddo Work\C#Learning\WpfApplication/Trivia.png" Margin="0,60,0,320" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBox x:Name="Username" Controls:TextBoxHelper.Watermark=" USERNAME" Margin="0,308,0,226" Width="200" Height="35" TextAlignment="Justify" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" />
<TextBox x:Name="Password" Controls:TextBoxHelper.Watermark=" PASSWORD" Margin="0,378,0,156" Width="200" Height="35" TextAlignment="Justify" FontSize="20" FontWeight="Bold" />
<Button x:Name="SignIn" Content="" HorizontalAlignment="Left" Margin="407,435,0,0" VerticalAlignment="Top" Width="80" Style="{DynamicResource MetroCircleButtonStyle}" Height="80" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="SignIn_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\User\Desktop\Iddo Work\C#Learning\WpfApplication/signIn.png"/>
</Button.Background>
</Button>
<Button x:Name="SignUp" Content="" HorizontalAlignment="Left" Margin="310,435,0,0" VerticalAlignment="Top" Width="80" Style="{DynamicResource MetroCircleButtonStyle}" Height="80" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="SignUp_Click">
<Button.Background>
<ImageBrush ImageSource="C:\Users\User\Desktop\Iddo Work\C#Learning\WpfApplication/sign-add-icon.png"/>
</Button.Background>
</Button>
</Grid>
Thank you in advance!
Updated answer:
Frames themselves are meant to load pages and your menu item is inheriting from a window so that will never work.
Here are the mods you need to make:
In your MainWindow.xaml change the Window tag to Controls:MetroWindow (like you have in your MainMenu xaml
In your MainWindow.xaml.cs remove the base class reference for the MainWindow (MainWindow : Window becomes just MainWindow)
In your MainMenu.xaml change Controls:MetroWindow to just UserControl
Back in your MainWindow.xaml, add a ref to your namespace xmlns:my="clr-namespace:WhateverHere"
In MainWindow.xaml, remove the and add your control directly instead
MainWindow.xaml
<Controls:MetroWindow x:Class="WPFDeleteMe.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:Dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
xmlns:my="clr-namespace:WPFDeleteMe"
Title="MainWindow" Height="700" Width="900">
<Grid x:Name="RootGrid">
<my:MainMenu></my:MainMenu>
</Grid>
</Controls:MetroWindow>
MainWindow.xaml.cs
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
}
}
MainMenu.xaml
<UserControl x:Class="WPFDeleteMe.MainMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<Grid>
<Image x:Name="Background" Source="d:\images\doll-161405_960_720.png" Stretch="UniformToFill">
<Image.BitmapEffect>
<BlurBitmapEffect Radius="17" />
</Image.BitmapEffect>
</Image>
<Image x:Name="Logo" Source="d:\images\Carestream_Solutions.gif" Margin="0,0,0,0" Width="150" Height="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button x:Name="SignIn" Content="" HorizontalAlignment="Left" Margin="407,435,0,0" VerticalAlignment="Top" Width="80" Height="80" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="SignIn_Click">
<Button.Background>
<ImageBrush ImageSource="d:\images\war_kitten.jpg"/>
</Button.Background>
</Button>
<Button x:Name="SignUp" Content="" HorizontalAlignment="Left" Margin="310,435,0,0" VerticalAlignment="Top" Width="80" Height="80" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="SignUp_Click">
<Button.Background>
<ImageBrush ImageSource="d:\images\war_kitten.jpg"/>
</Button.Background>
</Button>
</Grid>
</UserControl>
A large black area appears on the right side of the window when I run the program, and I can't figure out why. It's not there in the preview on the XAML file page in Visual Studio 2017, and I ran it once on a Windows 7 computer, and the black area wasn't there (I'm primarily on Windows 10). The problem could possibly be in another file, but I cannot find it.
<Window x:Class="Project.Widget"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Project"
mc:Ignorable="d"
Title="Menu"
WindowStartupLocation="Manual"
ResizeMode="NoResize"
Width="109"
SizeToContent="WidthAndHeight"
WindowState="Minimized"
Background="#2D3A48"
Topmost="False"
Loaded="Window_Loaded"
Closing="Window_Closing" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="77"/>
<RowDefinition Height="28"/>
<RowDefinition Height="90"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Image x:Name="Icon"
Source="./Resources/Icon.png"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Height="77"
Width="109" />
<Label x:Name="labelUsername"
Grid.Row="1"
Content=""
FontSize="14"
Foreground="White"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" />
<Label x:Name="labelScore"
Grid.Row="2"
Content="0%, 0 of 0"
Foreground="White"
FontSize="14"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,0,0,0" />
<Image x:Name="AvgScoreDot"
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Height="50"
Source=".\Resources\yellow_dot.png"
Margin="0,32,0,0"/>
<Label x:Name="labelAvgScore"
Grid.Row="2"
Content="0.0"
Foreground="White"
FontSize="24"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,35,0,0"
FontWeight="Bold" />
<Button x:Name="MailBtn"
Grid.Row="3"
Height="60"
Width="109"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderBrush="#FF2D3A48"
Click="Mail_Click" >
<Button.Background>
<ImageBrush
ImageSource="/Resources/mail.png"
Stretch="None" />
</Button.Background>
</Button>
<Button x:Name="MailBadgeBtn"
Grid.Row="3"
Content="0"
Foreground="White"
FontSize="11"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Height="20"
Width="20"
Margin="0,30,24,10"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="MailBadgeBtn_Click" BorderThickness="0">
<Button.Background>
<ImageBrush
ImageSource=".\Resources\red_dot.png" />
</Button.Background>
</Button>
<TextBlock x:Name="labelConnection"
Grid.Row="0"
Text=" No Connection or blocked by Firewall"
Foreground="Red"
Background="White"
TextWrapping="Wrap"
TextAlignment="Center"
VerticalAlignment="Center"
Height="77"
Width="109"
HorizontalAlignment="Center" />
</Grid>
Here's an image of what I get when I run it:
Here's what I get when I remove SizeToContent="WidthAndHeight" and add a height of 300 (I also had to remove your event handlers since I don't have that code, and add garbage images to the Resources folder since I don't have the original images):
Is that more like what you were looking for? You can also choose to explicitly set SizeToContent to "Manual".
In Windows 10 Universal app development the ScrollViewer causes App crashes. In the Windows dev Center this was also mentioned but not solved (https://social.msdn.microsoft.com/Forums/windowsapps/en-US/a737f407-d59f-4b10-a7d0-de9ead6d4f5f/uwpscrollviewer-occasional-crash?forum=wpdevelop).
Now my Problem:
I put a second grid on the Standard one of the xaml file. Then I added the ScrollViewer to this grid. After that i put another grid on the scrollviewer and then i added some Buttons to this grid. When scrolling the app crashes very often.
Do you have any idea how to fix that or how it can be done different?
Here the Code:
<Page
x:Class="ProjectMoralsKite.Datenbank"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ProjectMoralsKite"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid x:Name="grid">
<Grid.Background>
<ImageBrush Stretch="Fill"/>
</Grid.Background>
<Grid HorizontalAlignment="Left" Height="529" Margin="10,10,0,0" VerticalAlignment="Top" Width="340" BorderThickness="0,-1,0,0" Background="White" Opacity="0.6"/>
<TextBlock x:Name="textBlock" TextAlignment="Center" HorizontalAlignment="Left" Margin="6,70,0,0" TextWrapping="Wrap" Text="Verwaltung" VerticalAlignment="Top" Width="340" FontSize="29.333"/>
<Button x:Name="button" Content="Zurück" HorizontalAlignment="Left" Margin="10,507,0,0" VerticalAlignment="Top" Width="150" Click="button_Click"/>
<ScrollViewer HorizontalAlignment="Left" Height="380" Margin="10,109,0,0" VerticalAlignment="Top" Width="340">
<Grid HorizontalAlignment="Left" Height="655" VerticalAlignment="Top" Width="340">
<Button x:Name="button1" Content="Plan" HorizontalAlignment="Left" Margin="0,24,0,0" VerticalAlignment="Top" Height="54" Width="340"/>
<Button x:Name="button1_Copy" Content="Kunden" HorizontalAlignment="Left" Margin="0,83,0,0" VerticalAlignment="Top" Height="54" Width="340" Click="button1_Copy_Click"/>
<Button x:Name="button1_Copy1" Content="Baustellen" HorizontalAlignment="Left" Margin="0,142,0,0" VerticalAlignment="Top" Height="54" Width="340" Click="button1_Copy1_Click"/>
<Button x:Name="button1_Copy2" Content="Aufträge" HorizontalAlignment="Left" Margin="0,201,0,0" VerticalAlignment="Top" Height="54" Width="340" Background="#33000000" Click="button1_Copy2_Click"/>
<Button x:Name="button1_Copy3" Content="Zuweisung" HorizontalAlignment="Left" Margin="0,260,0,0" VerticalAlignment="Top" Height="54" Width="340" Background="#33FF0000"/>
<Button x:Name="button1_Copy4" Content="Rechteverwaltung" HorizontalAlignment="Left" Margin="0,319,0,0" VerticalAlignment="Top" Height="54" Width="340" Background="#33FF0000"/>
</Grid>
</ScrollViewer>
</Grid>
</Page>
Am newbie to wpf development.In my wpf app i used user control.what i need is in runtime how can resize the user control,
Please help me to find solution,if my approach is wrong please guide me to get solution,
My XAML code is
<UserControl x:Class="test.pad"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" Focusable="True" OverridesDefaultStyle="False">
<Grid Width="102" Height="123" Name="Grid1" MouseMove="Grid1_MouseMove" MouseUp="Grid1_MouseUp" MouseDown="Grid1_MouseDown">
<Grid.RenderTransform>
<TranslateTransform x:Name="tt"/>
</Grid.RenderTransform>
<Border BorderBrush="Silver" BorderThickness="2">
<Canvas Height="120" HorizontalAlignment="Left" Margin="0,1,0,0" Name="canvas1" VerticalAlignment="Top" Width="100" Grid.ColumnSpan="2">
<RichTextBox Height="98" HorizontalAlignment="Left" Margin="0,24,0,0" Name="richTextBox1" VerticalAlignment="Top" Width="100" BorderThickness="2" Grid.ColumnSpan="2" Background="#FFFF96D8" Canvas.Top="-3" Canvas.Left="-1" />
<Button BorderBrush="#FFFF96D8" Canvas.Left="46" Canvas.Top="-2" Height="23" Name="close" Width="27">
</Button>
<Button Height="23" Name="minimise" Width="27" BorderBrush="#FFFF96D8" Click="button1_Click" Canvas.Left="72" Canvas.Top="-2" ClipToBounds="False" IsEnabled="True" IsHitTestVisible="True" OverridesDefaultStyle="False" ForceCursor="False" Foreground="Black" MouseMove="button1_MouseEnter" MouseLeave="button1_MouseLeave">
</Canvas>
</Border>
</Grid>
</UserControl>
thanks
ash
Remove the Height and Width of the UserControl and also the Grid.
Set the Margin or Size Property for UserControl where you call it.