I have a WPF window. its xaml file is built of a UserControl tag:
<UserControl x:Class="DeploymentTool.View.ToolPanelMappingView"
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
...
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="1300"
>
Apparently it doesn't matter what I change the width size to (1300 in my case), it doesn't change the window size.
How can I change my window's width?
It seems that your control is hosted inside another window. Find the hosting window and change it as you wish.
Maybe you can try Snoop to fin the parent windwo and play with its properties to get the layput you want. Snoop on CodePlex
If I understand correctly, your xaml probably is like this:
<Window x:Class="WpfApplication1.SomeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SomeWindow" Height="700" Width="1300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<UserControl
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="30" Background="Green" Grid.Column="1" Grid.Row="1"></UserControl>
</Grid>
So to change width and height of UserControl, you can do it by adding rows or columns in the 'Grid'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.