Skip to content

Instantly share code, notes, and snippets.

@davidbitton
Created April 25, 2011 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidbitton/941088 to your computer and use it in GitHub Desktop.
Save davidbitton/941088 to your computer and use it in GitHub Desktop.
ActualWidth Binding Fail
<UserControl x:Class="OsgExporter.Shell.Views.TransmitView"
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" Loaded="TransmitView_OnLoaded"
d:DesignHeight="312" d:DesignWidth="496">
<Grid x:Name="LayoutRoot">
<Grid Margin="8,0,0,0" Height="Auto" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="{DynamicResource DarkBlueBorderBrush}" BorderThickness="{DynamicResource StandardBorderThickness}" Background="{DynamicResource LightBlueBorderBackground}" Padding="{DynamicResource StandardBorderPadding}" CornerRadius="{DynamicResource StandardBorderCornerRadius}" Margin="{DynamicResource StandardBorderMargin}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment" Margin="2">
<Label Content="Records:" Style="{DynamicResource SimpleLabel}" VerticalAlignment="Center" Margin="2"/>
<TextBox Style="{DynamicResource SimpleTextBox}" Text="{Binding Path=Records, Mode=TwoWay}" Margin="2" IsReadOnly="True" Width="100" />
</StackPanel>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" Margin="2">
<Label Content="Pages:" Style="{DynamicResource SimpleLabel}" VerticalAlignment="Center" Margin="2"/>
<TextBox Style="{DynamicResource SimpleTextBox}" Text="{Binding Path=Pages, Mode=TwoWay}" Margin="2" IsReadOnly="True" Width="100" />
</StackPanel>
<StackPanel x:Name="insertStackPanel" Grid.Row="1" Orientation="Horizontal" Margin="2">
<Label Content="Inserts:" Style="{DynamicResource SimpleLabel}" VerticalAlignment="Center" Margin="2"/>
<TextBox Style="{DynamicResource SimpleTextBox}" Text="{Binding Path=Inserts, Mode=TwoWay}" Margin="2" IsReadOnly="True" />
</StackPanel>
</Grid>
</Border>
<Border Grid.Row="1" BorderBrush="{DynamicResource DarkBlueBorderBrush}" BorderThickness="{DynamicResource StandardBorderThickness}" Background="{DynamicResource LightBlueBorderBackground}" Padding="{DynamicResource StandardBorderPadding}" CornerRadius="{DynamicResource StandardBorderCornerRadius}" Margin="{DynamicResource StandardBorderMargin}">
<StackPanel Orientation="Horizontal" Margin="2">
<Label Content="Processing Option:" Style="{DynamicResource SimpleLabel}" VerticalAlignment="Center" Margin="2"/>
<Label Content="{Binding Path=ProcessingOption}" Style="{DynamicResource SimpleLabel}" VerticalAlignment="Center" Margin="2"/>
</StackPanel>
</Border>
<Border Grid.Row="2" BorderBrush="{DynamicResource DarkBlueBorderBrush}" BorderThickness="{DynamicResource StandardBorderThickness}" Background="{DynamicResource LightBlueBorderBackground}" Padding="{DynamicResource StandardBorderPadding}" CornerRadius="{DynamicResource StandardBorderCornerRadius}" Margin="{DynamicResource StandardBorderMargin}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="2">
<Button Content="Upload" Style="{DynamicResource SimpleButton}" Margin="2" Width="50" Command="{Binding Path=UploadCommand}" />
</StackPanel>
</Border>
</Grid>
</Grid>
</UserControl>
@davidbitton
Copy link
Author

just put

Width="{Binding ActualWidth, ElementName=stackPanel, Mode=OneWay}"

in the TextBox contained within insertStackPanel. When you do this, you can no longer scroll the window up and down on the right side of Blend 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment