Binding slider to 3D line movement action in XAML in WPF - c#

I have build a WPF 3D project using C# in windows 7.
I have just created 2 sliders(vertical and horizontal)and 2 3D lines (vertical and horizontal), want to bind slider to 3D line movement action, respectively.
XAML:
<UserControl x:Class="STIGenericReport.UserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tool3d="clr-namespace:_3DTools;assembly=3DTools"
Height="407" Width="633" Background="White" BorderBrush="White" Focusable="False">
<Grid Name="maingrid" Background="White" Height="405" Width="616" MinWidth="500">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="619*" />
<ColumnDefinition Width="10*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height ="574*" />
<RowDefinition Height="26" MinHeight="16" />
</Grid.RowDefinitions>
<Viewport3D Name="mainViewport" ClipToBounds = "False"
IsHitTestVisible="false"
RenderOptions.EdgeMode="Aliased" Margin="12,52,144,47">
<Viewport3D.Camera>
<OrthographicCamera x:Name="camera" Width="2"
FarPlaneDistance="10"
NearPlaneDistance="1"
LookDirection="0,0,-1"
UpDirection="0,1,0"
Position="0,0,2" />
</Viewport3D.Camera>
<Viewport3D.Children>
<ModelVisual3D x:Name="Light1">
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="1, 1, -1" />
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:Name="Light2">
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="-1, 1, -1" />
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:Name="Light3">
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="0,-1,-0.5" />
</ModelVisual3D.Content>
</ModelVisual3D>
<tool3d:ScreenSpaceLines3D Points ="0,100,0,0,-100,0" Color="Black" Thickness="2"/>
<tool3d:ScreenSpaceLines3D Points ="-100,0,0,100,0,0" Color="Black" Thickness="2"/>
</Viewport3D.Children>
</Viewport3D>
<Canvas x:Name="canvasOn3D" Background="#00E6FFFF"
Margin="20,52,102,18"></Canvas>
<Label Content="Trayinfo" FontSize="16" FontWeight="Bold" Height="34" HorizontalAlignment="Left" Margin="192,0,0,0" Name="lblTrayinfo" VerticalAlignment="Top" Width="194" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,257" Name="btn9" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,232" Name="btn8" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button HorizontalAlignment="Left" Margin="499,149,0,207" Name="btn7" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,182" Name="btn6" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,157" Name="btn5" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,132" Name="btn4" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,107" Name="btn3" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,82" Name="btn2" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,57" Name="btn1" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Button Height="25" HorizontalAlignment="Left" Margin="499,0,0,282" Name="btn10" VerticalAlignment="Bottom" Width="50" Background="White" BorderThickness="0" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,57" Name="lbl1" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,82" Name="lbl2" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,107" Name="lbl3" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,132" Name="lbl4" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,157" Name="lbl5" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,182" Name="lbl6" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,207" Name="lbl7" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,232" Name="lbl8" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,257" Name="lbl9" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Height="25" HorizontalAlignment="Right" Margin="0,0,12,282" Name="lbl10" VerticalAlignment="Bottom" Width="45" Background="White" BorderBrush="White" />
<Label Content="Pacakage info" HorizontalAlignment="Center" Width="Auto" Height="32" Name="lblPkgname" FontSize="16" FontWeight="Bold" Margin="20,371,102,2" Grid.RowSpan="2" />
<Slider x:Name="slider" HorizontalAlignment="Left" Margin="20,357,0,0" VerticalAlignment="Top" Width="484"/>
<Slider x:Name="slider1" HorizontalAlignment="Left" Margin="-148,205,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Width="326">
<Slider.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="89.89"/>
<TranslateTransform/>
</TransformGroup>
</Slider.RenderTransform>
</Slider>
</Grid>
namespace _3DTools
{
public class ScreenSpaceLines3D : ModelVisual3D
{
public static readonly DependencyProperty ColorProperty;
public static readonly DependencyProperty ThicknessProperty;
public static readonly DependencyProperty PointsProperty;
public ScreenSpaceLines3D();
public Color Color { get; set; }
public double Thickness { get; set; }
public Point3DCollection Points { get; set; }
public void MakeWireframe(Model3D model);
}
}
I want to achieve this function:
when I move the horizontal slider, the vertical line move horizontally;
when I move the vertical slider, the horizontal line move vertically.
How add such kind of binding? I have tried to use normal method but failed.

Give your horizontal slider a minimum and maximum value:
<Slider x:Name="slider" Minimum="-1" Maximum="1" HorizontalAlignment="Left" Margin="20,357,0,0" VerticalAlignment="Top" Width="484" />
And then apply a transform offset to your horizontal line, binding OffsetY to the slider's value:
<tool3d:ScreenSpaceLines3D Points ="-100,0,0,100,0,0" Color="Black" Thickness="2">
<tool3d:ScreenSpaceLines3D.Transform>
<TranslateTransform3D OffsetX="0" OffsetY="{Binding ElementName=slider, Path=Value}" OffsetZ="0" />
</tool3d:ScreenSpaceLines3D.Transform>
</tool3d:ScreenSpaceLines3D>
Repeat for the other axis.

Related

WPF White screen and 1 GB of umanaged RAM usage on Windows 8.1 and Windows 7

I have a problem with WPF Application. It runs perfectly on Windows 10, tested on latest update 1803 and latest Insider Fast, but when application is run on Windows 8 or 7, application starts, uses 1 GB of unamanged RAM for few milliseconds and then renders only white screen. App is running and I can see cursor changing and code running in background, but when I try to move Window for example, application crashes with Out Of Memory exception and Application does not have enough memory to execute.
I do not understand this problem, I tried removing code from it... It can be libraries or XAML.
I tried different .NET versions. I am out of ideas.
Did anyone ever had this problem? How to solve it? I can publish code if required to get help... I am really lost.
<Window x:Name="mainWindow" x:Class="GameV2.MainWindow"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:local="clr-namespace:GameV2"
xmlns:GameEngine="clr-namespace:GameEngine;assembly=GameEngineV2"
xmlns:zp="clr-namespace:ZoomAndPan;assembly=ZoomAndPan"
mc:Ignorable="d" TextElement.Foreground="{DynamicResource MaterialDesignBody}" Background="Black"
Title="MainWindow" Height="640" Width="1280" PreviewKeyDown="mainWindow_PreviewKeyDown">
<Grid Margin="0,0,0,0">
<materialDesign:DialogHost IsTabStop="False">
<Grid>
<ScrollViewer CanContentScroll="True"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden" Grid.Row="1">
<zp:ZoomAndPanControl UseAnimations="True" MinimumZoomType="FitScreen" ZoomAndPanInitialPosition="FitScreen" x:Name="zoomBorder">
<Grid x:Name="maingrid" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" UseLayoutRounding="True" SnapsToDevicePixels="True" Width="Auto" Height="Auto">
</Grid>
</zp:ZoomAndPanControl>
</ScrollViewer>
<!--GUI-->
<Grid Panel.ZIndex="3">
<!--TOP PANEL-->
<Grid x:Name="menuControlGrid" Margin="0,0,0,0" Width="Auto" Height="50" VerticalAlignment="Top" Panel.ZIndex="9999" Background="#99000000" RenderOptions.BitmapScalingMode="HighQuality">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="485"/>
<ColumnDefinition Width="1*" MinWidth="250"/>
<ColumnDefinition Width="195"/>
</Grid.ColumnDefinitions>
<Button x:Name="menuButton" HorizontalAlignment="Right" Margin="0,10,5,10" Width="30" Height="Auto" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Grid.Column="2" Click="menuButton_Click"/>
<Image HorizontalAlignment="Right" Margin="0,10,5,10" Width="30" Height="Auto" Grid.Column="2" Source="Resources/Icons/menu.png" IsHitTestVisible="False"/>
<ToggleButton x:Name="buildButton" Content="BUILD" HorizontalAlignment="Center" Margin="-30,10,0,10" Width="105" Height="Auto" Style="{DynamicResource MaterialDesignRaisedLightButton}" Grid.Column="2" Checked="buildButton_Checked" Unchecked="buildButton_Unchecked"/>
<Grid HorizontalAlignment="Left" Margin="5,7,0,3" Width="105" Grid.Column="0">
<materialDesign:Card >
<Grid>
<Image Source="Resources/Icons/Status/happy.png" Margin="5,0,0,6" HorizontalAlignment="Left" Width="25" Height="25" VerticalAlignment="Bottom"/>
<TextBox TextWrapping="NoWrap" Cursor="Arrow" Text="65 535" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="40,5,0,5" Width="50" IsReadOnly="True" Focusable="False" IsTabStop="False" TextAlignment="Center" FontSize="15" FontFamily="{StaticResource MaterialDesignFont}" FontWeight="DemiBold"></TextBox>
</Grid>
</materialDesign:Card>
</Grid>
<Grid HorizontalAlignment="Left" Margin="115,7,0,3" Width="155" Grid.Column="0">
<materialDesign:Card>
<Grid>
<Image Source="Resources/Icons/balance.png" Margin="5,0,0,6" HorizontalAlignment="Left" Width="25" Height="25" VerticalAlignment="Bottom"/>
<TextBox TextWrapping="NoWrap" Cursor="Arrow" Text="2 147 483 647" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="40,5,0,5" Width="100" IsReadOnly="True" Focusable="False" IsTabStop="False" TextAlignment="Center" FontSize="15" FontFamily="{StaticResource MaterialDesignFont}" FontWeight="DemiBold" />
</Grid>
</materialDesign:Card>
</Grid>
<Grid HorizontalAlignment="Left" Margin="275,7,0,3" Width="115" Grid.Column="0">
<materialDesign:Card >
<Grid>
<Image Source="Resources/Icons/profit.png" Margin="5,0,0,6" HorizontalAlignment="Left" Width="25" Height="25" VerticalAlignment="Bottom"/>
<TextBox TextWrapping="NoWrap" Cursor="Arrow" Text="999 999" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="40,5,0,5" Width="60" IsReadOnly="True" Focusable="False" IsTabStop="False" TextAlignment="Center" FontSize="15" FontFamily="{StaticResource MaterialDesignFont}" FontWeight="DemiBold"/>
</Grid>
</materialDesign:Card>
</Grid>
<Grid HorizontalAlignment="Left" Margin="395,7,0,3" Width="85" Grid.Column="0">
<materialDesign:Card >
<Grid>
<Image Source="Resources/Icons/quests.png" Margin="5,0,0,6" HorizontalAlignment="Left" Width="25" Height="25" VerticalAlignment="Bottom"/>
<TextBox TextWrapping="NoWrap" Cursor="Arrow" Text="255" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="40,5,0,5" Width="30" IsReadOnly="True" Focusable="False" IsTabStop="False" TextAlignment="Center" FontSize="15" FontFamily="{StaticResource MaterialDesignFont}" FontWeight="DemiBold"/>
</Grid>
</materialDesign:Card>
</Grid>
<Grid Margin="25.2,7,25.4,3" Grid.Column="1">
<materialDesign:Card >
<Grid>
<Image Source="Resources/Icons/calendar.png" Margin="5,0,0,6" HorizontalAlignment="Left" Width="25" Height="25" VerticalAlignment="Bottom"/>
<TextBox TextWrapping="NoWrap" x:Name="clockText" Cursor="Arrow" Text="{Binding Path=ClockMessageText, ElementName=mainWindow}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="40,5,0,5" Width="120" IsReadOnly="True" Focusable="False" IsTabStop="False" TextAlignment="Center" FontSize="15" FontFamily="{StaticResource MaterialDesignFont}" FontWeight="DemiBold"/>
<Border BorderBrush="{DynamicResource MaterialDesignBody}" BorderThickness="1,1,1,1" CornerRadius="6,6,6,6" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="170,5,5,5">
<Grid SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="18*"/>
<ColumnDefinition Width="16*"/>
<ColumnDefinition Width="14*"/>
<ColumnDefinition Width="12*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="0" />
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="1" />
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="2" />
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="3" />
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="4" />
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="5" />
<Rectangle Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="Black" Grid.Column="6" />
</Grid>
</Border>
</Grid>
</materialDesign:Card>
</Grid>
</Grid>
<Path Width="10" Height="10" Margin="500.35,49.75,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#99000000" RenderTransformOrigin="0.5,0.5" IsHitTestVisible="False" RenderOptions.EdgeMode="Aliased">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
<Path.Data>
<PathGeometry PresentationOptions:Freeze="True" Figures="M 10,0 5,0 Q 0,0 0,5 L 0,10 L 0,0 L 10,0" />
</Path.Data>
</Path>
<Path Width="10" Height="10" Margin="656,50,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#99000000" IsHitTestVisible="False" RenderOptions.EdgeMode="Aliased">
<Path.Data>
<PathGeometry PresentationOptions:Freeze="True" Figures="M 10,0 5,0 Q 0,0 0,5 L 0,10 L 0,0 L 10,0" />
</Path.Data>
</Path>
<Border BorderBrush="{DynamicResource MaterialDesignBody}" BorderThickness="0,0,0,0" CornerRadius="0,0,9,9" Margin="510,50,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Height="33" Width="146" Background="#99000000" Panel.ZIndex="10000" RenderOptions.BitmapScalingMode="HighQuality" RenderOptions.EdgeMode="Aliased">
<Grid x:Name="menuTimeGrid">
<Grid Margin="10,0,0,0" Height="28" Width="28" VerticalAlignment="Top" HorizontalAlignment="Left">
<Button x:Name="pause" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Width="26" Height="26" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled" Click="pause_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/Time/pause.png"/>
</Grid>
<Grid Margin="43,0,0,0" Height="28" Width="28" VerticalAlignment="Top" HorizontalAlignment="Left" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="play" Style="{DynamicResource MaterialDesignFloatingActionButton}" Width="26" Height="26" Click="play_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/Time/Play.png"/>
</Grid>
<Grid Margin="76,0,0,0" Height="28" Width="28" VerticalAlignment="Top" HorizontalAlignment="Left" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="playFast" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Width="26" Height="26" Click="playFast_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/Time/fast.png"/>
</Grid>
<Grid Margin="109,0,0,0" Height="28" Width="28" VerticalAlignment="Top" HorizontalAlignment="Left" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="playFastest" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Width="26" Height="26" Click="playFastest_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/Time/fastest.png"/>
</Grid>
</Grid>
</Border>
<!--RIGHT PANEL-->
<Grid x:Name="buildGrid" VerticalAlignment="Stretch" HorizontalAlignment="Right" Margin="0,50,0,0" Width="220" Visibility="Hidden">
<Grid.RowDefinitions>
<RowDefinition Height="100px"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="buttonsBorder" Grid.Row="0" Background="#99000000" BorderBrush="{DynamicResource MaterialDesignBody}" BorderThickness="0,0,0,0" CornerRadius="0,0,0,9">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBox Width="100" Height="1" RenderTransformOrigin="0.5,0.5" Margin="130.5,49,-10,49" TextWrapping="NoWrap" IsHitTestVisible="False" IsEnabled="False" Cursor="Arrow" HorizontalAlignment="Left" Grid.RowSpan="2">
<TextBox.RenderTransform>
<TransformGroup>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<Grid Grid.Row="0">
<Grid HorizontalAlignment="Left" Margin="5,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="roadButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="RoadButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/road.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="40,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="structureButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="StructureButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/foundaments.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="75,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="wallButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="WallButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/walls.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="110,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="objectButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="ObjectButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/objects.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="145,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="floorButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="FloorButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/floors.png" ></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="185,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="zoneButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="ZoneButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/Planning.png"></Image>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid HorizontalAlignment="Left" Margin="5,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="disRoadButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="DisRoadButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/noroad.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="40,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="disStructureButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="DisStructureButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/nofoundaments.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="75,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="disWallButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="DisWallButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/nowalls.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="110,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="disObjectButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="DisObjectButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/noobjects.png"></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="145,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="disFloorButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="DisFloorButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/nofloors.png" ></Image>
</Grid>
<Grid HorizontalAlignment="Left" Margin="185,10,0,0" VerticalAlignment="Top" Width="30" Height="30" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased" RenderOptions.ClearTypeHint="Enabled">
<Button x:Name="assignJobButton" Width="30" Height="30" Style="{DynamicResource MaterialDesignFloatingActionLightButton}" Click="AssignJobButton_Click"/>
<Image Margin="5,5,5,5" IsHitTestVisible="False" Source="Resources/Icons/RightPanel/Assigment.png"></Image>
</Grid>
</Grid>
</Grid>
</Border>
<Border x:Name="contentBorder" Grid.Row="1" Background="#99000000" Visibility="Hidden">
<ContentControl x:Name="buildMenuContent"/>
</Border>
</Grid>
<Path Height="10" Margin="0,50,220,0" VerticalAlignment="Top" Fill="#99000000" RenderTransformOrigin="0.5,0.5" IsHitTestVisible="False" HorizontalAlignment="Right" Width="10" Visibility="{Binding ElementName=buildGrid, Path=Visibility}" RenderOptions.EdgeMode="Aliased">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
<Path.Data>
<PathGeometry PresentationOptions:Freeze="True" Figures="M 10,0 5,0 Q 0,0 0,5 L 0,10 L 0,0 L 10,0" />
</Path.Data>
</Path>
</Grid>
<Grid Panel.ZIndex="2" Background="{Binding Path=DayNightBrush, ElementName=mainWindow}" Opacity="{Binding Path=DayNightOpacity, ElementName=mainWindow}" IsHitTestVisible="False"/>
</Grid>
</materialDesign:DialogHost>
</Grid>
</Window>
And background code https://pastebin.com/gbBqLeWH
You must have set these two properties to your Window:
window.AllowsTransparency = true;
window.WindowStyle = WindowStyle.None;
This two properties will change your window into a layered window and will take much more memory than a normal one.
If you have done so, remove it. If you want a custom title bar, try to use a WindowChrome.
Read more about window style customize using WindowChrome:
WindowChrome Class (System.Windows.Shell) - Microsoft Docs
WPF 使用 WindowChrome,在自定义窗口标题栏的同时最大程度保留原生窗口样式(类似 UWP/Chrome) - walterlv

WPF/C# vertical Accordion control another way? [duplicate]

This question already has answers here:
WPF Clipping Problem
(2 answers)
WPF Transformations -- Rotating and switching width/height?
(3 answers)
Closed 5 years ago.
I try to do the horizontal accordion control to be a vertical control.
So I used a simple trick
<Controls:Accordion.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1"/>
<RotateTransform Angle="90"/>
</TransformGroup>
</Controls:Accordion.RenderTransform>
This is working fine, but the problem comes now.
When I resize the window or an element in the accordion control its all get broken. Its all change width is height and height is the width, but I'm not sure how to fix it.
I hope someone has an idea.
My whole code from Xaml
<Window
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:WIHAAccordionTemplate"
xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit" x:Class="WIHAAccordionTemplate.MainWindow"
mc:Ignorable="d"
Title="MainWindow"
x:Name="parentControl"
Height="auto"
Width="auto"
WindowStartupLocation="CenterOwner"
WindowStyle="SingleBorderWindow"
SizeChanged="parentControl_SizeChanged"
Background="Green">
<Grid x:Name="childControl" Width="auto" Height="auto" SizeChanged="parentControl_SizeChanged">
<Controls:Accordion x:Name="AccordionControlTemplate" HorizontalAlignment="Center" Margin="0,0,0,0" MinHeight="500" MinWidth="300" Height="auto" Width="auto" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" SizeChanged="parentControl_SizeChanged">
<Controls:Accordion.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1"/>
<RotateTransform Angle="90"/>
</TransformGroup>
</Controls:Accordion.RenderTransform>
<Controls:AccordionItem x:Name="configItem" Header="Config" Style="{DynamicResource AccordionItemHeaderStyle}">
<Grid x:Name="configItemGrid" Style="{StaticResource GridStyleAccordion}">
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="parkingstationItem" Header="Parkingstation" Style="{DynamicResource AccordionItemHeaderStyle}">
<Grid x:Name="parkingStationItemGrid" Style="{StaticResource GridStyleAccordion}">
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="addNewUserItem" Header="add new User" Width="auto" Height="auto" Style="{DynamicResource AccordionItemHeaderStyle}" >
<Grid x:Name="addNewUserItemGrid" Style="{StaticResource GridStyleAccordion}" >
<Grid x:Name="userNew" MinWidth="200" MinHeight="200" Style="{StaticResource GridPosition}" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270"/>
</TransformGroup>
</Grid.RenderTransform>
<Label x:Name="nameN" Content="Benutzer:" HorizontalAlignment="Left" Margin="23,23,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="operatorIDN" Content="OperatorID:" HorizontalAlignment="Left" Margin="11,50,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="deviceIDN" Content="DeviceID:" HorizontalAlignment="Left" Margin="23,81,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="passwortN" Content="Passwort:" HorizontalAlignment="Left" Margin="21,110,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="aktivN" Content="Aktiv:" HorizontalAlignment="Left" Margin="45,139,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<TextBox x:Name="userTextBox" HorizontalAlignment="Left" Height="23" Margin="140,24,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" FontFamily="{DynamicResource WihaFontFamaly}"/>
<TextBox x:Name="operatorTextBox" HorizontalAlignment="Left" Height="23" Margin="140,51,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" FontFamily="{DynamicResource WihaFontFamaly}"/>
<TextBox x:Name="deviceTextBox" HorizontalAlignment="Left" Height="23" Margin="140,82,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120" FontFamily="{DynamicResource WihaFontFamaly}"/>
<PasswordBox x:Name="passwordBox" HorizontalAlignment="Left" Height="23" Margin="140,111,0,0" VerticalAlignment="Top" Width="120"/>
<CheckBox x:Name="aktivCheckBox" HorizontalAlignment="Left" Margin="140,145,0,0" VerticalAlignment="Top"/>
<Button x:Name="button" Content="Save" Click="button_Click" HorizontalAlignment="Left" Margin="61,175,0,0" VerticalAlignment="Top" Style="{DynamicResource ButtonStyleWIHA}" />
</Grid>
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="userPanelItem" Header="User Panel" Style="{DynamicResource AccordionItemHeaderStyle}" IsSelected="True">
<Grid x:Name="userPanelItemGrid" Style="{StaticResource GridStyleAccordion}" >
<DataGrid x:Name="userDataGrid" CanUserReorderColumns="True" CanUserResizeColumns="True" CanUserResizeRows="True" RowDetailsVisibilityMode="VisibleWhenSelected" IsReadOnly="True" AlternatingRowBackground="{DynamicResource WihaGrauB}" ColumnWidth="auto" ColumnHeaderHeight="30" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="0,401,-111,-304" Width="auto" Height="auto">
<DataGrid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270"/>
</TransformGroup>
</DataGrid.RenderTransform>
<DataGrid.Columns>
<DataGridTextColumn Header="Benutzer" Binding="{Binding Name}" MinWidth="150" Width="auto" />
<DataGridTextColumn Header="OperatorID" Binding="{Binding OperatorID}" MinWidth="200" Width="auto"/>
<DataGridCheckBoxColumn Header="Aktiv" Binding="{Binding Aktiv}" MinWidth="50" Width="auto"/>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DockPanel>
<Image DockPanel.Dock="Left" Source="{Binding ImageUrl}" Height="30" Width="25" Margin="10,0,0,0"/>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Name: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="1" Margin="2,2,2,2"/>
<TextBox Text="{Binding Name}" Grid.Column="1" Width="150" TextAlignment="Center" HorizontalAlignment="Left" Grid.Row="1" Margin="2,2,2,2" />
<TextBlock Text="OperatorID: " FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="2" FontWeight="Bold" Margin="2,2,2,2"/>
<TextBox x:Name="operatorText" Text="{Binding OperatorID}" Width="150" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" TextAlignment="Center" Margin="2,2,2,2" />
<TextBlock Text="DeviceID: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="3" Margin="2,2,2,2"/>
<TextBox Text="{Binding DeviceID}" Grid.Column="3" Width="150" HorizontalAlignment="Left" Grid.Row="3" TextAlignment="Center" Margin="2,2,2,2"/>
<TextBlock Text="Passwort: " FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold" Grid.Row="4" Margin="2,2,2,2"/>
<TextBox Text="{Binding Passwort}" Grid.Column="4" Width="150" HorizontalAlignment="Left" Grid.Row="4" TextAlignment="Center" Margin="2,2,2,2"/>
<TextBlock Text="Aktiv:" FontWeight="Bold" FontFamily="{DynamicResource WihaFontFamaly}" Grid.Row="5" Margin="2,2,2,2"/>
<CheckBox Grid.Column="5" Grid.Row="5" IsChecked="{Binding Aktiv}" Margin="2,2,2,2" />
</Grid>
</DockPanel>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</Grid>
</Controls:AccordionItem>
<Controls:AccordionItem x:Name="userloginItem" Width="auto" Height="auto" Header="Login" Style="{DynamicResource AccordionItemHeaderStyle}" >
<Grid x:Name="userLoginItemGrid" Style="{StaticResource GridStyleAccordion}">
<Grid x:Name="userLogin" Height="auto" Width="auto" Style="{StaticResource GridPosition}" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270"/>
</TransformGroup>
</Grid.RenderTransform>
<TextBox x:Name="usernameLoginTextBox" HorizontalAlignment="Center" Height="23" Margin="20,54,22,88" TextWrapping="Wrap" Text="" VerticalAlignment="Center" Width="120"/>
<Button x:Name="loginButton" Content="Login" Click="button_Click" HorizontalAlignment="Left" Margin="20,140,0,0" VerticalAlignment="Top" Style="{DynamicResource ButtonStyleWIHA}"/>
<PasswordBox x:Name="loginPasswordBox" HorizontalAlignment="Left" Margin="20,101,0,0" Width="120" Height="23" VerticalAlignment="Top"/>
<Label x:Name="label" Content="Benutzername:" HorizontalAlignment="Left" Margin="20,38,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
<Label x:Name="label1" Content="Passwort:" HorizontalAlignment="Left" Margin="20,85,0,0" VerticalAlignment="Top" FontFamily="{DynamicResource WihaFontFamaly}" FontWeight="Bold"/>
</Grid>
</Grid>
</Controls:AccordionItem>
</Controls:Accordion>
</Grid>
and at the moment it looks like this
how it looks

How to set multiple buttons, textblocks and textboxes underneath each other in WPF?

Right now I have the following:
<DockPanel Height="150">
<Button DockPanel.Dock="Right" Padding="5" Margin="5 0 5 0" FontWeight="Bold" Content="Submit" Click="Button_Click"/>
<TextBlock TextAlignment="Left" Padding="5" Text="DVM Positive Readout" />
<Border Height="25" BorderBrush="Black" BorderThickness="1" DockPanel.Dock="Top">
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Center" x:Name="DVM_Positive_ReadOut" LostKeyboardFocus="DVM_Positive_ReadOut_LostKeyboardFocus" />
</Border>
<Border Height="25" BorderBrush="Black" BorderThickness="1" DockPanel.Dock="Top">
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Center" x:Name="DVM_Negavtive_ReadOut" LostKeyboardFocus="DVM_Negative_ReadOut_LostKeyboardFocus" />
</Border>
</DockPanel>
Which results in:
I want to have two submit buttons and two textblocks. The Textboxes are correctly stacked, though it would be nice if they were centered.
Like this:
You can achieve this by using StackPanel with its horizontal or vertical attribute:
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock TextAlignment="Left"
Padding="5"
Text="DVM Positive Readout"
Width="150"/>
<Border Height="25"
BorderBrush="Black"
BorderThickness="1"
Width="150"
DockPanel.Dock="Top">
<TextBox HorizontalAlignment="Stretch"
VerticalAlignment="Center"
x:Name="DVM_Positive_ReadOut"
LostKeyboardFocus="DVM_Positive_ReadOut_LostKeyboardFocus" />
</Border>
<Button DockPanel.Dock="Right"
Padding="5"
Margin="5 0 5 0"
FontWeight="Bold"
Content="Submit"
Click="Button_Click" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock TextAlignment="Left"
Padding="5"
Text="DVM Negative Readout"
Width="150" />
<Border Height="25"
BorderBrush="Black"
BorderThickness="1"
Width="150"
DockPanel.Dock="Top">
<TextBox HorizontalAlignment="Stretch"
VerticalAlignment="Center"
x:Name="DVM_Negavtive_ReadOut"
LostKeyboardFocus="DVM_Negative_ReadOut_LostKeyboardFocus" />
</Border>
<Button DockPanel.Dock="Right"
Padding="5"
Margin="5 0 5 0"
FontWeight="Bold"
Content="Submit"
Click="Button_Click" />
</StackPanel>
</StackPanel>

How do I resize TextBox to fit the Window size when it Maximized/Minimized?

How can I resize my TextBoxe's/Label's to fit the window size when I maximize/minimize it? At this point textboxes just go to the center of the window. What I want that they resized to fit the grid columns and rows size. How can I do that? I tried to difine to what column and row textbox belongs, thougth, it will resize accordingly to ColumnDefinition, but that didn't change anything.
<DockPanel Margin="2,46,0,0" Name="dockPanel1" Width="Auto">
<TabControl Height="Auto" Name="tabControl1" Width="Auto" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" DockPanel.Dock="Top">
<TabItem Header="tabItem1" Name="tabItem1">
<Grid Name="grid1" HorizontalAlignment="Center" VerticalAlignment="Top" Height="523" Width="766">
<Grid.RowDefinitions>
<RowDefinition MinHeight="0" Height="43*" />
<RowDefinition Height="45*" />
<RowDefinition Height="435*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="0" Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="100" />
<ColumnDefinition Width="385*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Grid.Row="0" Height="27" Name="textBox1" VerticalAlignment="Top" Margin="0,4,0,0" HorizontalAlignment="Right" Width="141" FontSize="14" HorizontalContentAlignment="Stretch" />
<Label Content="Label" Height="9" HorizontalAlignment="Left" Margin="16,7,0,0" Name="label1" VerticalAlignment="Top" Width="35" />
<Label Content="Supplier" Height="27" Name="label2" VerticalAlignment="Top" FontSize="14" FontFamily="Tahoma" FontWeight="Bold" Margin="6,4,0,0" Width="133" IsEnabled="True" HorizontalAlignment="Left" Foreground="Black" Background="White" />
<TextBox FontSize="14" Height="27" HorizontalAlignment="Stretch" Margin="140,6,0,0" Name="textBox11" VerticalAlignment="Top" Width="141" Grid.Row="1" />
<Label Content="Supplier Bank" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Height="27" Margin="6,6,142,0" Name="label3" VerticalAlignment="Top" Width="133" Grid.Row="1" Background="White" />
<TextBox FontSize="14" Height="27" HorizontalAlignment="Stretch" Margin="140,7,0,0" Name="textBox12" VerticalAlignment="Top" Width="141" Grid.Row="2" />
<Label Content="Account Number" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Height="27" Margin="6,7,142,0" Name="label4" VerticalAlignment="Top" Width="133" Grid.Row="2" Background="White" />
<TextBox FontSize="14" Height="27" Margin="134,4,110,0" Name="textBox2" VerticalAlignment="Top" Grid.Column="2" HorizontalAlignment="Stretch" Width="141" DataContext="{Binding ElementName=grid1, Path=ActualWidth}" />
<Label Content="Buyer" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Height="27" Margin="0,4,252,0" Name="label5" VerticalAlignment="Top" Width="133" Grid.Column="2" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Background="White" />
<TextBox FontSize="14" Grid.Row="1" Height="27" HorizontalAlignment="Left" Margin="134,6,0,0" Name="textBox3" VerticalAlignment="Top" Width="141" Grid.Column="2" />
<Label Content="Buyer Bank" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Grid.Row="1" Height="27" Margin="0,6,0,0" Name="label6" VerticalAlignment="Top" Width="133" Grid.Column="2" HorizontalAlignment="Left" Background="White" />
<TextBox FontSize="14" Grid.Row="2" Height="27" HorizontalAlignment="Left" Margin="134,7,0,0" Name="textBox4" VerticalAlignment="Top" Width="141" Grid.Column="2" />
<Label Content="Account Number" FontFamily="Tahoma" FontSize="14" FontWeight="Bold" Grid.Row="2" Height="27" Margin="0,7,0,0" Name="label7" VerticalAlignment="Top" Width="133" Grid.Column="2" HorizontalAlignment="Left" Background="White" />
</Grid>
</TabItem>
<TabControl.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0.035" />
<GradientStop Color="#FF1B327A" Offset="0.528" />
<GradientStop Color="#FF001E98" Offset="0.278" />
</LinearGradientBrush>
</TabControl.Background>
</TabControl>
</DockPanel>
Dont use a static value for the width attribute.
You can try "HorizontalAlignment=Stretch".

XAMLparse exceoption error

Please I need assistance... My program which i am using c# and post relational database but i keep getting this error it says the xaml parse exception error was unhandled , please where am i going wrong the code is
<Window x:Class="zooSystemWorking.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="442" Width="884" Loaded="Window_Loaded" ResizeMode="NoResize">
<Grid Background="#F2C1D42D" Height="405">
<Image Height="139" HorizontalAlignment="Left" Margin="1,1,0,0" Source="/zooSystemWorking;component/Images/ZooLogo.jpg" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="104" />
<Border BorderBrush="#FF0A0A09" BorderThickness="1" Height="25" HorizontalAlignment="Left" Margin="6,145,0,0" Name="border1" VerticalAlignment="Top" Width="93" CornerRadius="10" Background="#95005202">
<Button Content="Add Animal" Height="23" Name="addAnimal" Click="addAnimal_Click" Width="87" Background="#95005202" Padding="0" BorderBrush="#95005202" Foreground="#F2C1D42D" />
</Border>
<Border BorderBrush="#FF101010" BorderThickness="1" Height="25" Name="border2" Width="93" Margin="6,185,764,195" CornerRadius="10" Background="#95005202">
<Button Content="View Animal" Height="23" Name="viewAnimal" Click="viewAnimal_Click" Width="86" Background="#95005202" Foreground="#F2C1D42D" />
</Border>
<Border BorderBrush="#FF0A0A09" BorderThickness="1" Height="25" Name="border3" Width="93" Margin="6,227,764,153" CornerRadius="10" Background="#95005202">
<Button Content="Update Animal" Height="23" Name="updateAnimal" Click="updateAnimal_Click" Width="84" Background="#95005202" Foreground="#F2C1D42D" />
</Border>
<Border BorderBrush="#FF0D0D0C" BorderThickness="1" Height="25" Name="border4" Width="93" Margin="6,268,764,112" CornerRadius="10" Background="#95005202">
<Button Content="Archive Animal" Height="23" Name="archiveAnimal" Click="archiveAnimal_Click" Width="84" Background="#95005202" BorderBrush="#95005202" Padding="0" Foreground="#F2C1D42D" />
</Border>
<ContentControl Height="326" HorizontalAlignment="Left" Margin="105,-1,0,0" Name="contentArea" VerticalAlignment="Top" Width="758" />
<Image Height="72" HorizontalAlignment="Left" Margin="1,333,0,0" Name="image2" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="142,333,0,0" Name="image3" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="286,333,0,0" Name="image4" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="429,333,0,0" Name="image5" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="572,333,0,0" Name="image6" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="717,333,0,0" Name="image7" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Border Background="#95005202" BorderBrush="#FF0D0D0C" BorderThickness="1" CornerRadius="10" Height="25" Margin="6,305,763,75" Name="border5" Width="93">
<Button Background="#95005202" BorderBrush="#95005202" Click="reportGen_Click" Content="Report" Foreground="#F2C1D42D" Height="23" Name="reportGen" Padding="0" Width="84" />
</Border>
</Grid>
</Window>

Categories

Resources