locked
Xaml designer behaves differently in VS 2012 and VS 2010 RRS feed

  • Question

  • I recently switched to Visual Studio 2012 from VS2010. I have some user controls which are templates for other user controls. The first ones have some ContentControl whose content is defined in the second ones.

    Follows the definition of a user control based on a template control (ImpegniBaseView)

    <localView:ImpegniBaseView>
    
            <localView:ImpegniBaseView.ActionButtons>
                <StackPanel Height="54" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="668" Orientation="Horizontal">
                    <Button Content="Salva" Height="31" Width="88"  Command="{Binding Path=SaveCommand}" IsEnabled="{Binding Editable}" Margin="5,0" />
                    <Button Command="{Binding Path=CreateCommand}" Content="Nuovo impegno master" Height="31" Width="Auto" 
                        Visibility="{Binding IsFirstLevelView, Converter={StaticResource BoolToVisibility}}"    
                        IsEnabled="{Binding Path=Editable, Converter={StaticResource InverseBooleanConverter}}" Margin="5,0" />
    
                </StackPanel>
            </localView:ImpegniBaseView.ActionButtons>
        </localView:ImpegniBaseView>


    In Vs 2010 I could easily select, for example, the button 'Salva' in the designer. Now I cannot. I suppose I have to change an option in the designer, but I don't know which one...

    Follows the relevant part of the user control used as template

    <UserControl x:Class="Ragioneria.View.ImpegniBaseView"
             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:local="clr-namespace:Ragioneria"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="700">
    
    <DockPanel DataContext="{Binding ImpegnoSelezionato}">
        <DockPanel DockPanel.Dock="Top">
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
                <Label Content="Anno/Num-Sub" Height="28" HorizontalAlignment="Left" Margin="5" Name="label1" VerticalAlignment="Top" Width="Auto" />
                <ContentControl  Content="{Binding Path=IdentificazioneImpegnoSection, RelativeSource={RelativeSource AncestorType=UserControl}}" Width="400" Height="28" Margin="5" />
    
    
    
            </StackPanel>
    
            <TextBox Height="28" Width="100" Name="textBox9" Text="{Binding Path=DataRegistrazione, StringFormat=d}" DockPanel.Dock="Right" Style="{DynamicResource tb_readonly}" TextAlignment="Right" Margin="5" />
            <Label Content="Data" Height="28" Margin="5" Name="label7" Width="50" DockPanel.Dock="Right"/>
    
        </DockPanel>
    
        <ContentControl DockPanel.Dock="Bottom"  
                        DataContext="{Binding DataContext.ActiveWorkspace, RelativeSource={RelativeSource  AncestorType=Window}}"
                        Content="{Binding Path=ActionButtons, RelativeSource={RelativeSource AncestorType=UserControl}}" />
    </DockPanel>

    My goal is to select, for example, the button 'Salva' with a double click in the designer, but in Vs2012 desktop edition I cannot do it because it select the whole user control I used as template ( ImpegniBaseView)

    Thanks

    Filippo


    Monday, December 3, 2012 10:09 AM