Click here to Skip to main content
15,885,757 members
Home / Discussions / WPF
   

WPF

 
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 
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 
The Viewbox has Stretch="Uniform". That means it won't change the aspect ratio of the child Canvas.

If you resize the window so that row 1 has an aspect ratio that isn't 256 × 125 (1024 × 500), then you'll end up with spaces around your Viewbox, either on the left and right sides, or on the top and bottom sides.

If you want to fill the entire background of the row, add a Rectangle to the same grid row, outside of the Viewbox, and set your fill there. You'll need to add it to the markup before the Viewbox, so that the rectangle appears behind it.
XML
<Rectangle Grid.Row="1" Fill="Bisque" />

<Viewbox  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" StretchDirection="Both">
    <Canvas Width="1024" Height="500"> <!-- No background colour here -->
        ...
    </Canvas>
</Viewbox>




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

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 
AnswerRe: Bind TabItem ContexMenu Command To Window VM Pin
Richard Deeming9-Jul-18 8:35
mveRichard Deeming9-Jul-18 8:35 

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.