Click here to Skip to main content
15,884,472 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF: Customizing the appearence of a window n XAML Pin
Pew_new29-Aug-18 4:31
Pew_new29-Aug-18 4:31 
SuggestionRe: WPF: Customizing the appearence of a window n XAML Pin
Richard Deeming29-Aug-18 2:56
mveRichard Deeming29-Aug-18 2:56 
GeneralRe: WPF: Customizing the appearence of a window n XAML Pin
Pew_new29-Aug-18 3:12
Pew_new29-Aug-18 3:12 
QuestionWPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new21-Aug-18 5:13
Pew_new21-Aug-18 5:13 
AnswerRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Richard Deeming21-Aug-18 9:59
mveRichard Deeming21-Aug-18 9:59 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new21-Aug-18 22:02
Pew_new21-Aug-18 22:02 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Richard Deeming22-Aug-18 2:21
mveRichard Deeming22-Aug-18 2:21 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new23-Aug-18 0:41
Pew_new23-Aug-18 0:41 
hello Richard,
While playing around "Symbiosis" of ViewBox and Canvas I stumbled across a weird behavior of Canvas.
Eg., both ViewBox and Canvas are (Grid.Row="1"). I've got "Row1" dimensions and made a Canvas (Sketch inside) with exactly same dimensions. Then I put it into a ViewBox. Yes, as I wrote yesterday this "Symbiosis" keeps position and scales controls. That's true.
However, I noticed one weirdness. I colored Canvas and when I maximized window (1920x1080) I had seen that Canvas hadn't overlapped entire width of the window. There were two pretty wide, vertical non-colored "columns", to the left and right of colored Canvas.

P.S. I've tried to play with Canvas' height and width, to no avail. It just disappears, if it has no dimensions.

Code:
<Window x:Class="WpfApplication6.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:local="clr-namespace:WpfApplication6"
        mc:Ignorable="d"
        Title="MainWindow" Height="768" Width="1024" MinHeight="768" MinWidth="1024" MaxHeight="1080" MaxWidth="1920" WindowStartupLocation="CenterScreen" >


    <Grid ShowGridLines="True">
        <Grid.RowDefinitions >

            <RowDefinition Height="80"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="160"/>

        </Grid.RowDefinitions>

        <Viewbox  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" StretchDirection="Both">

            <Canvas  Width="1024" Height="500"  Background="Bisque">

                <Path Data="M319.5,255.83333 L511.5,255.47633" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1.357" Margin="255.468,175.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="193"/>
                <Path Data="M511.57098,255.50012 L526.16688,303.50007" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="49" Margin="447.468,175.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="15.596"/>
                <Path Data="M526.62867,303.49938 L526.62867,319.49875" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="17" Margin="462.064,223.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="1"/>
                <Path Data="M319.5,235.34375 L319.5,299" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="64.656" Margin="255.468,175.844,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="1"/>
                <Path Data="M321,320.5 L336,320.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="255.468,239.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="16"/>
                <Path Data="M444.85589,319.5 L459.39349,319.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="447.468,239.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="15.537"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28.5" Margin="259.468,179.5,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="31.5"/>
                <Path Data="M446.54684,283.34826 L453.83331,299.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="39" Margin="445.468,181.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="11.266"/>
                <Path Data="M442.48196,282.90707 L442.58496,299.49959" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="39" Margin="439.468,181.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="1.103"/>
                <Path Data="M441.82235,299.49664 L453.8333,299.49666" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="439.468,219.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="17.266"/>
                <Ellipse Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="25" Margin="419.365,227.302,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="25"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28" Margin="531.921,176,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="65"/>
                <TextBlock x:Name="textBlock" HorizontalAlignment="Left" Height="17" Margin="534.924,181,0,0" Grid.Row="1"  Text="Bus station" VerticalAlignment="Top" Width="59" Foreground="#FF4E2323"/>
                <Path Data="M590.09595,283.93897 L590.09595,336.20181" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="52" Margin="561.819,202.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="3" StrokeThickness="3"/>
                <Path Data="M503.5,261.5 L509.5,261.857" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1.357" Margin="439.468,181.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="7"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="32.143" Margin="424.218,181.857,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="14.5"/>
                <Path Data="M511.91667,319.5 L504.91667,305.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="15" Margin="441.468,225.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="7"/>
                <Path Data="M483.95601,305.5 L504.95601,305.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="420.468,225.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="22"/>
                <Path Data="M484.5,305.5 L479,319.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="15" Margin="414.968,225.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="6.5"/>
                <Ellipse Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="25" Margin="274.968,227.302,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="25"/>
                <Path Data="M511.91667,319.5 L504.91667,305.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="15" Margin="297.435,225.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="7"/>
                <Path Data="M483.95601,305.5 L504.95601,305.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="276.602,225.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="22"/>
                <Path Data="M484.867,305.5 L479,319.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="15" Margin="270.601,225.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="6.867"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28.5" Margin="295.968,179.5,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="31.5"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28.5" Margin="332.468,179.5,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="31.5"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="28.5" Margin="366.968,179.5,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="21"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="58.5" Margin="389.968,179.5,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="20"/>
                <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="26.143" Margin="392.968,181.857,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="14"/>
                <Path Data="M367.50001,319.5 L479.08333,319.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="303.468,239.5,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="112.583"/>
                <Ellipse Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="8" Margin="283.593,235.375,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="8"/>
                <Ellipse Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="8" Margin="428.218,235.5,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="8"/>
                <Path Data="M320.5,332.302 L668.532,333.5" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="2.198" Margin="256.468,252.302,0,0" Grid.Row="1" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="349.032"/>
                <Path Data="M512.5,119 L512.5,529" Fill="#FFF5F4F4" HorizontalAlignment="Left" Height="411" Margin="495.158,39,0,0" Grid.Row="1" Stretch="Fill" Stroke="#FFF11C3A" VerticalAlignment="Top" Width="1"/>
                <TextBlock x:Name="textBlock1" HorizontalAlignment="Left" Height="39" TextWrapping="Wrap" Text="I need that Row" VerticalAlignment="Top" Width="331" FontSize="24" TextAlignment="Center" Canvas.Left="334" Canvas.Top="-59"/>
                <TextBlock x:Name="textBlock1_Copy" HorizontalAlignment="Left" Height="39" TextWrapping="Wrap" Text="I need that Row" VerticalAlignment="Top" Width="332" FontSize="24" TextAlignment="Center" Grid.Row="2" Canvas.Left="332" Canvas.Top="562"/>
                <TextBlock x:Name="textBlock2" HorizontalAlignment="Left" Height="24" Margin="387.968,10,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Center vert. line of the 1024x768 screen" VerticalAlignment="Top" Width="277.032"/>

            </Canvas>
        </Viewbox>


    </Grid>




</Window>


thanks in advance!

modified 23-Aug-18 7:00am.

GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Richard Deeming23-Aug-18 8:15
mveRichard Deeming23-Aug-18 8:15 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new23-Aug-18 8:34
Pew_new23-Aug-18 8:34 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Richard Deeming23-Aug-18 8:39
mveRichard Deeming23-Aug-18 8:39 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new23-Aug-18 8:52
Pew_new23-Aug-18 8:52 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Richard Deeming23-Aug-18 9:05
mveRichard Deeming23-Aug-18 9:05 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new24-Aug-18 3:09
Pew_new24-Aug-18 3:09 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Gerry Schmitz24-Aug-18 6:08
mveGerry Schmitz24-Aug-18 6:08 
GeneralRe: WPF: Can't get what I need to do to get things right (responsive controls). Pin
Pew_new25-Aug-18 7:36
Pew_new25-Aug-18 7:36 
QuestionScale items with ViewBox within an ItemsControl Pin
Kenneth Haugland7-Aug-18 6:07
mvaKenneth Haugland7-Aug-18 6:07 
AnswerRe: Scale items with ViewBox within an ItemsControl Pin
Kenneth Haugland8-Aug-18 3:56
mvaKenneth Haugland8-Aug-18 3:56 
QuestionPredicateBuilder Question Pin
Kevin Marois14-Jul-18 18:21
professionalKevin Marois14-Jul-18 18:21 
AnswerRe: PredicateBuilder Question Pin
Richard Deeming16-Jul-18 8:19
mveRichard Deeming16-Jul-18 8:19 
AnswerRe: PredicateBuilder Question Pin
Gerry Schmitz16-Jul-18 10:15
mveGerry Schmitz16-Jul-18 10:15 
QuestionWPF HyperLink Binding To MainWindowViewMOdel Not Working Pin
Kevin Marois9-Jul-18 17:02
professionalKevin Marois9-Jul-18 17:02 
AnswerRe: WPF HyperLink Binding To MainWindowViewMOdel Not Working Pin
Pete O'Hanlon9-Jul-18 20:07
mvePete O'Hanlon9-Jul-18 20:07 
GeneralRe: WPF HyperLink Binding To MainWindowViewMOdel Not Working Pin
Kevin Marois10-Jul-18 6:53
professionalKevin Marois10-Jul-18 6:53 
QuestionBind TabItem ContexMenu Command To Window VM Pin
Kevin Marois8-Jul-18 12:03
professionalKevin Marois8-Jul-18 12:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.