I want to use pathGeometry from my icon.xaml file my project but WPF does not show how can i use my icons?
Please find my codes and screenshot below.
<StackPanel Grid.Row="1" Margin="-1 40 0 20">
<Button x:Name="btnHome" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnHome_MouseEnter" MouseLeave="btnHome_MouseLeave" Click="btnHome_Click">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource home}" IconWidth="16" Text="Factory Method" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnDashboard" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnDashboard_MouseEnter" MouseLeave="btnDashboard_MouseLeave" Click="btnDashboard_Click">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource dashboard}" IconWidth="16" Text="Dashboard" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnProducts" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnProducts_MouseEnter" MouseLeave="btnProducts_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource products}" IconWidth="16" Text="Products" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnProductStock" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnProductStock_MouseEnter" MouseLeave="btnProductStock_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource car}" IconWidth="16" Text="Product Stock" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnOrderList" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnOrderList_MouseEnter" MouseLeave="btnOrderList_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource email}" IconWidth="16" Text="Order List" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnBilling" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnBilling_MouseEnter" MouseLeave="btnBilling_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource billing}" IconWidth="16" Text="Billing" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnPointOfSale" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnPointOfSale_MouseEnter" MouseLeave="btnPointOfSale_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource car}" IconWidth="16" Text="Point Of Sale" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnSecurity" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnSecurity_MouseEnter" MouseLeave="btnSecurity_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource lock}" IconWidth="16" Text="Security" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnSetting" Style="{DynamicResource PopupButtonStyle}" MouseEnter="btnSetting_MouseEnter" MouseLeave="btnSetting_MouseLeave">
<ctls:MenuItem GroupName="MenuItem" IndicatorBrush="{DynamicResource PrimaryBlueColor}" Icon="{DynamicResource settings}" IconWidth="16" Text="Setting" VerticalAlignment="Center"/>
</Button>
</StackPanel>
Have you loaded you icon.xaml in Application Resources?
Like this:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="icon.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Related
In my program there is a standard keyboard that I use for the "Entry"
However I'm testing some things and I ended up putting IsEnabled = True, but when the program goes into Focus on that Entry, the default Android Softkeyboard appears, and I do not want it to appear when I click on Entry.
How do I not display the SoftKeyboard in Entry?
<Label Text="CÓD VENDEDOR:"
FontSize="Large"
FontAttributes="Bold"
TextColor="Black"/>
<Entry Placeholder="000000000000000"
Text="{Binding codVend}"
Keyboard="numeric"
MaxLength="15"
FontSize="Large"
FontAttributes="Bold"
IsEnabled="True"
TextColor="Black"
InputTransparent="False"/>
<Label Text="N LÓGICO:"
FontSize="Large"
FontAttributes="Bold"
TextColor="Black"/>
<Entry Placeholder="00000000"
Text="{Binding codTrn}"
Keyboard="Numeric"
MaxLength="8"
IsEnabled="True"
FontSize="Large"
FontAttributes="Bold"
TextColor="Black"
InputTransparent="False"/>
<StackLayout Padding="2"
HorizontalOptions="Center"
VerticalOptions="Center">
<ActivityIndicator IsVisible="{Binding IsBusy}"
IsRunning="{Binding IsBusy}"
Color="Blue"/>
<!-- Place new controls here -->
<StackLayout HorizontalOptions="Center"
VerticalOptions="Center"
Padding="5">
<Grid HorizontalOptions="Center"
VerticalOptions="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<!--Row 1-->
<Button Text="1"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="0"
Grid.Row="0"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="1"/>
<Button Text="2"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="1"
Grid.Row="0"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="2"/>
<Button Text="3"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="2"
Grid.Row="0"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="3"/>
<Button Text="OK"
BackgroundColor="Green"
TextColor="White"
BorderRadius="10"
Grid.Column="3"
Grid.Row="0"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
Grid.RowSpan="4"
Command="{Binding SaveCommand}"/>
<!--Row 2-->
<Button Text="4"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="0"
Grid.Row="1"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="4"/>
<Button Text="5"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="1"
Grid.Row="1"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="5"/>
<Button Text="6"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="2"
Grid.Row="1"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="6"/>
<!--Row 3-->
<Button Text="7"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="0"
Grid.Row="2"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="7"/>
<Button Text="8"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="1"
Grid.Row="2"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="8"/>
<Button Text="9"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="2"
Grid.Row="2"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="9"/>
<!--Row 4-->
<Button Text="X"
BackgroundColor="Red"
TextColor="White"
BorderRadius="10"
Grid.Column="0"
Grid.Row="3"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Center"
Command="{Binding ClearAllCommand}"/>
<Button Text="0"
BackgroundColor="Blue"
TextColor="White"
BorderRadius="10"
Grid.Column="1"
Grid.Row="3"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
VerticalOptions="Center"
Command="{Binding NumericCommand}"
CommandParameter="0"/>
<Button Text="C"
BackgroundColor="Yellow"
TextColor="White"
BorderRadius="10"
Grid.Column="2"
Grid.Row="3"
HeightRequest="60"
FontSize="Large"
FontAttributes="Bold"
HorizontalOptions="Center"
Command="{Binding ClearCommand}"/>
</Grid>
</StackLayout>
</StackLayout>
</StackLayout>
</ContentPage.Content>
Customizing an Entry in Native android can do this:
First, creating a MyEntry
public class MyEntry : Entry
{
}
Second ,using in Xaml:
<ContentPage ...
xmlns:local="clr-namespace:CustomRenderer;assembly=CustomRenderer"
...>
...
<local:MyEntry Text="In Shared Code" />
...
</ContentPage>
Third, modify in Renderer on Android
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(MyEntry), typeof(MyEntryRenderer))]
namespace CustomRenderer.Android
{
class MyEntryRenderer : EntryRenderer
{
public MyEntryRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.InputType = Android.Text.InputTypes.Null;
//Set input type be null, keyboard will never appear,even when click the Entry.If need show keyboard, this way also can be used.
//Control.InputType = Android.Text.InputTypes.ClassText;
}
}
}
}
Is it possible with WPF/ MaterialDesignInXamlToolkit
to display ToolBar as Dock right aligned?
Default is left aligned.
I think I should modify this Style file.
but I could not find "DockPanel.Dock="Left"
<ToolBarTray>
<ToolBar Style="{DynamicResource MaterialDesignToolBar}" ClipToBounds="False" >
<Button ToolTip="Home">
<materialDesign:PackIcon Kind="Home" />
</Button>
<Button ToolTip="Add">
<materialDesign:PackIcon Kind="AccountMultiplePlus" />
</Button>
<Button ToolTip="Test">
<materialDesign:PackIcon Kind="FlagCheckered" />
</Button>
<Separator />
<Button ToolTip="Layer" >
<materialDesign:PackIcon Kind="Layers" />
</Button>
<Separator />
<Button ToolTip="Setting" >
<materialDesign:PackIcon Kind="Settings" />
</Button>
<Button ToolTip="Help">
<materialDesign:PackIcon Kind="HelpCircleOutline" />
</Button>
</ToolBar>
</ToolBarTray>
<ToolBarTray FlowDirection="RightToLeft">
<ToolBar Style="{DynamicResource MaterialDesignToolBar}" ClipToBounds="False" >
<Button ToolTip="Home">
<materialDesign:PackIcon Kind="Home" />
</Button>
<Button ToolTip="Add">
<materialDesign:PackIcon Kind="AccountMultiplePlus" />
</Button>
<Button ToolTip="Test">
<materialDesign:PackIcon Kind="FlagCheckered" />
</Button>
<Separator />
<Button ToolTip="Layer" >
<materialDesign:PackIcon Kind="Layers" />
</Button>
<Separator />
<Button ToolTip="Setting" >
<materialDesign:PackIcon Kind="Settings" />
</Button>
<Button ToolTip="Help">
<materialDesign:PackIcon Kind="HelpCircleOutline" />
</Button>
</ToolBar>
</ToolBarTray>
Following codes are okey.
<DockPanel>
<Canvas>
<Button Name="Button6" Canvas.Left="60" Canvas.Top="10" Height="100" Width="100" Panel.ZIndex="1"/>
<Button Name="Button5" Canvas.Left="60" Canvas.Top="10" Height="100" Width="100" Panel.ZIndex="2"/>
<Button Name="Button4" Canvas.Left="60" Canvas.Top="10" Height="100" Width="100" Panel.ZIndex="3"/>
<Button Name="Button3" Canvas.Left="60" Canvas.Top="10" Height="100" Width="100" Panel.ZIndex="4"/>
<Button Name="Button2" Canvas.Left="60" Canvas.Top="10" Height="100" Width="100" Panel.ZIndex="5"/>
<Button Name="Button1" Canvas.Left="60" Canvas.Top="10" Height="100" Width="100" Panel.ZIndex="6"/>
</Canvas>
</DockPanel>
.
Panel.SetZIndex(Button2, Panel.GetZIndex(Button1) + Panel.GetZIndex(Button3) + Panel.GetZIndex(Button4) + Panel.GetZIndex(Button5) + +Panel.GetZIndex(Button6))
But I want to use more professional code instead of the second code above.
Following coding looks okey. But following code is C#. I need vb.net code.
https://stackoverflow.com/a/6044491
I am learning wpf and xaml. And I want to disable the showing of date picker when cancil button is clicked. How can I achieve that in XAML using style. So when the red cancil button is clicked I want to hide or disable the date picker. Please help me.
Below is what I have till now
<UserControl x:Class="ucWorkOrderActivity"
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" Height="74" Width="570" Background="White" BorderBrush="Gray" BorderThickness="1" Loaded="UserControl_Loaded" MouseDoubleClick="UserControl_MouseDoubleClick">
<Grid>
<DockPanel Name="dkpControl" Margin="10,0,25,0" >
<StackPanel Name="stpMoveButtons" Orientation="Vertical" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="5,0,0,0">
<Button Name="btnUp" Click="btnUp_Click" Height="25" Width="25" Content="▲" ToolTip="Move Action Up" IsEnabled="{Binding Path=IsUpEnabled}" Margin="0,5,5,10" />
<Button Name="btnDown" Click="btnDown_Click" Height="25" Width="25" Content="▼" ToolTip="Move Action Down" Margin="0,0,5,10" IsEnabled="{Binding Path=IsDownEnabled}" />
</StackPanel>
<DockPanel DockPanel.Dock="Top" Margin="0,0,5,0" >
<TextBlock Name="txbDesc" Text="{Binding Path=Description}" Width="150" TextTrimming="CharacterEllipsis" Margin="10,5,5,5" VerticalAlignment="Top" />
<DockPanel Margin="5,0" HorizontalAlignment="Right" DockPanel.Dock="Right" Width="358" >
<TextBlock Name="txbCostLabel" Text="Cost: " DockPanel.Dock="Left" VerticalAlignment="Top" Margin="46,5,0,5" />
<TextBlock Name="txbCost" Text="{Binding Path=AmountCharged}" TextAlignment="Right" DockPanel.Dock="Left" Width="50" Margin="5" VerticalAlignment="Top" />
<DatePicker Name="dtpCompleted" DockPanel.Dock="Right" Height="25" VerticalAlignment="Top" Margin="0,1,0,0" SelectedDate="{Binding Path=EndDate}" Width="90" />
<TextBlock Name="txbStatus" Text="{Binding Path=Status}" DockPanel.Dock="right" HorizontalAlignment="Left" Width="60" Margin="45,5,30,5" TextAlignment="Left" VerticalAlignment="Top" />
</DockPanel>
</DockPanel>
<DockPanel DockPanel.Dock="Bottom" Margin="0,0,5,0" >
<Image Name="imgLocationChange" Margin="25,0" DockPanel.Dock="Left" Height="24" Source="/SMS_Main;component/Resources/UnitMoveLoc_24.png" Visibility="Hidden" />
<TextBlock Name="txbCharge" Text="{Binding Path=ChargeWhen}" Margin="70,0,0,0" VerticalAlignment="Center" />
<Button Name="btnComplete" Height="26" Width="26" DockPanel.Dock="Right" HorizontalAlignment="Right" Click="btnComplete_Click" ToolTip="Complete Action" >
<Image Source="/SMS_Main;component/Resources/OK_24.png" Margin="2" />
</Button>
<Button Name="btnCancel" Height="26" Width="26" DockPanel.Dock="Right" HorizontalAlignment="Right" Click="btnCancel_Click" ToolTip="Remove Action">
<Image Source="/SMS_Main;component/Resources/Cancel_24.png" Margin="2" />
</Button>
<Button Name="btnRevert" Height="26" Width="26" DockPanel.Dock="Right" HorizontalAlignment="Right" Click="btnRevert_Click" IsEnabled="{Binding Path=CurrentlySaved}" ToolTip="Revert Change">
<Image Source="/SMS_Main;component/Resources/Undo_24.png" Margin="2" />
</Button>
<Button Name="btnEdit" Height="26" Width="26" DockPanel.Dock="Right" HorizontalAlignment="Right" Click="btnEdit_Click" ToolTip="Edit Action" >
<Image Margin="2" Source="/SMS_Main;component/Resources/Config_24.png" />
</Button>
<TextBlock Name="txbAssignedTo" Text="{Binding Path=AssignedUser}" VerticalAlignment="Center" DockPanel.Dock="Right" HorizontalAlignment="Left" Margin="95,0,10,0" />
</DockPanel>
</DockPanel>
</Grid>
</UserControl>
.
You can add an event trigger to the cancel button:
<Button Name="btnCancel" Height="26" Width="26" DockPanel.Dock="Right" HorizontalAlignment="Right" ToolTip="Remove Action" Content="Cancel">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsEnabled" Storyboard.TargetName="dtpCompleted">
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
I do not have an idea of how to make the menu bar, tool bar, and canvas fix their positions. While scrolling they shouldn't move.
I have a WPF window where I have a menu bar and a tool bar and two canvases.
Canvas 1 is in XAML and canvas 2 is dynamic through vb.net
Now I want to fix the first three.
Menu bar
Tool bar
Canvas 1
Here is my XAML:
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" >
<DockPanel>
<Grid ScrollViewer.HorizontalScrollBarVisibility="Visible" >
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="350"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Menu x:Name="menu1" BorderBrush="AliceBlue" VerticalAlignment="Top" FontFamily="Comic Sans MS" >
<MenuItem Header="_File" Width="92" FontSize="16" FontWeight="Normal" FontFamily="Century Gothic" >
<MenuItem Header="Location" FontSize="16">
<MenuItem Header="01" />
<MenuItem Header="02"/>
<MenuItem Header="03"/>
<MenuItem Header="04"/>
<MenuItem Header="05"/>
<MenuItem Header="06"/>
<MenuItem Header="07"/>
<MenuItem Header="08"/>
<MenuItem Header="09"/>
<MenuItem Header="10"/>
<MenuItem Header="11"/>
<MenuItem Header="12"/>
<MenuItem Header="13"/>
<MenuItem Header="14"/>
</MenuItem>
<MenuItem Header="_Print"/>
<MenuItem Header="_Print Preview"/>
<MenuItem Header="_Exit"/>
</MenuItem>
</Menu>
<ToolBar Grid.Row="1" x:Name="toolBar1" BorderBrush="Red" BorderThickness="3" Margin="0,0,0,900" Grid.RowSpan="2" Height="30" VerticalAlignment="Top" >
<Button x:Name="Zoomin" Click="menuItemZoomin_Click" HorizontalAlignment="Left" Margin="1" Width="90" FontSize="16" FontWeight="SemiBold" Height="55" RenderTransformOrigin ="0.917,0.587" IsHitTestVisible="True" IsEnabled="True" FontFamily="Century Gothic" Content="Zoom In" />
<Button x:Name="Zoomout" Click="menuItemZoomout_Click" HorizontalAlignment="Left" Margin="1" Width="90" FontSize="16" FontWeight="SemiBold" RenderTransformOrigin="0.917,0.587" Height="55" FontFamily="Century Gothic" Content="Zoom Out"/>
<Button x:Name="Print" Click="PrintBtn_Click" HorizontalAlignment="Left" Margin="1" Width="90" FontSize="16" FontWeight="SemiBold" RenderTransformOrigin="0.917,0.587" Height="55" FontFamily="Century Gothic" Content="Print"/>
</ToolBar>
<DockPanel>
<Canvas x:Name="cvsZoneColor" DockPanel.Dock="Top" >
<Rectangle Width="25" Height="25" Margin="60 60 60 950" >
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<Color A="219" R="219" G="249" B="217" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="A" Margin="60 80 60 950" Width="20" Height="20" ></TextBlock>
<Rectangle Width="25" Height="25" Margin="90 60 70 990" >
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<Color A="219" R="255" G="238" B="204" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="B" Margin="90 80 70 950" Width="20" Height="20" ></TextBlock>
<Rectangle Width="25" Height="25" Margin="120 60 70 990" >
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<Color A="219" R="204" G="238" B="255" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="C" Margin="120 80 70 950" Width="20" Height="20" ></TextBlock>
<Rectangle Width="25" Height="25" Margin="150 60 70 990" >
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<Color A="219" R="204" G="238" B="221" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="D" Margin="150 80 70 950" Width="20" Height="20" ></TextBlock>
<Rectangle Width="25" Height="25" Margin="180 60 70 990" >
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<Color A="219" R="255" G="221" B="238" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="E" Margin="180 80 70 950" Width="20" Height="20" ></TextBlock>
<Rectangle Width="25" Height="25" Margin="210 60 70 990" >
<Rectangle.Fill>
<SolidColorBrush>
<SolidColorBrush.Color>
<Color A="219" R="255" G="238" B="255" />
</SolidColorBrush.Color>
</SolidColorBrush>
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="F" Margin="210 80 70 950" Width="20" Height="20" ></TextBlock>
</Canvas>
</DockPanel>
<Canvas x:Name="cvsWarehouse" Focusable="True" ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" MouseWheel="Canvas_MouseWheel" Grid.Row="3" RenderTransformOrigin="0.5,0.5" Margin="0,150,0,0" >
<Canvas.LayoutTransform>
<TransformGroup>
<ScaleTransform x:Name ="st1" ScaleX="{Binding Value, ElementName=uiScaleSlider}"
ScaleY="{Binding Value, ElementName=uiScaleSlider}" />
<TranslateTransform Y="100" />
</TransformGroup>
</Canvas.LayoutTransform>
</Canvas>
</Grid>
</DockPanel>
</ScrollViewer>
Scrolling the bar on the right hand side shouldn't move these three highlighted ...
Image
While using DockPanel, it's important to keep note of order.
You should use below XAML as your starting point and modify it for your needs :
<Window ...>
<DockPanel LastChildFill="True">
<Menu x:Name="menu1" BorderBrush="AliceBlue" VerticalAlignment="Top" FontFamily="Comic Sans MS" DockPanel.Dock="Top">
<MenuItem Header="_File" Width="92" FontSize="16" FontWeight="Normal" FontFamily="Century Gothic" >
<MenuItem Header="Location" FontSize="16">
<MenuItem Header="01" />
<MenuItem Header="02"/>
<MenuItem Header="03"/>
<MenuItem Header="04"/>
<MenuItem Header="05"/>
<MenuItem Header="06"/>
<MenuItem Header="07"/>
<MenuItem Header="08"/>
<MenuItem Header="09"/>
<MenuItem Header="10"/>
<MenuItem Header="11"/>
<MenuItem Header="12"/>
<MenuItem Header="13"/>
<MenuItem Header="14"/>
</MenuItem>
<MenuItem Header="_Print"/>
<MenuItem Header="_Print Preview"/>
<MenuItem Header="_Exit"/>
</MenuItem>
</Menu>
<ToolBar x:Name="toolBar1" BorderBrush="Red" BorderThickness="3" Height="30" VerticalAlignment="Top" DockPanel.Dock="Top">
<Button x:Name="Zoomin" Click="menuItemZoomin_Click" HorizontalAlignment="Left" Margin="1" Width="90" FontSize="16" FontWeight="SemiBold" Height="55" RenderTransformOrigin ="0.917,0.587" IsHitTestVisible="True" IsEnabled="True" FontFamily="Century Gothic" Content="Zoom In" />
<Button x:Name="Zoomout" Click="menuItemZoomout_Click" HorizontalAlignment="Left" Margin="1" Width="90" FontSize="16" FontWeight="SemiBold" RenderTransformOrigin="0.917,0.587" Height="55" FontFamily="Century Gothic" Content="Zoom Out"/>
<Button x:Name="Print" Click="PrintBtn_Click" HorizontalAlignment="Left" Margin="1" Width="90" FontSize="16" FontWeight="SemiBold" RenderTransformOrigin="0.917,0.587" Height="55" FontFamily="Century Gothic" Content="Print"/>
</ToolBar>
<Canvas Background="Pink" DockPanel.Dock="Bottom" Height="25">
<TextBlock Text="Bottom"/>
</Canvas>
<ScrollViewer>
<Canvas Background="Red" ScrollViewer.VerticalScrollBarVisibility="Visible">
<Button Content="Press"/>
</Canvas>
</ScrollViewer>
</DockPanel>
</Window>
I think this might get you a UI closer to what it looks like you are trying to do. If you make the XAML to use the dock panel more, you can get a more fixed UI.
<DockPanel LastChildFill="True">
<Menu x:Name="menu1" DockPanel.Dock="Top">
<MenuItem Header="_File" >
...
</Menu>
<ToolBar x:Name="toolBar1" DockPanel.Dock="Top">
...
</ToolBar>
<Grid x:Name="cvsZoneColor" DockPanel.Dock="Top">
<StackPanel Orientation="Vertical">
<Rectangle Width="25" Height="25" Margin="60 0 60 0" >
...
</Rectangle>
<TextBlock Text="A" Margin="60 0 60 0" Width="20" Height="20"/>
</StackPanel>
...
</Grid>
<ScrollViewer DockPanel.Dock="Bottom">
<Canvas x:Name="cvsWarehouse">
...
</Canvas>
</ScrollViewer>
</DockPanel>