locked
Blend 3 and EditModeSwitchButton RRS feed

  • Question

  • Hello,

    While porting my custom blend editors from Blend 2 to Blend 3 Preview, i notice that the visual aspect of "EditModeSwitchButton" have changed : In Blend 2, it is as expected : Button. In Blend 3, it is displayed as a small down arrow...

    Could you please tell me if it's a bug, or if i miss something ?

    Thanks !

    Monday, March 30, 2009 4:35 PM

Answers

  • Super Unni ! It Works !

    Thanks a lot for your help !!
    • Marked as answer by Fred POINDRON Thursday, April 2, 2009 7:05 AM
    Thursday, April 2, 2009 7:04 AM

All replies

  • I made a fix that changed the visuals - I was thinking that nobody would be using the pin and extended modes, but perhaps I was wrong :).

    Are you using those modes (assuming you are writing a property value editor)? If not, the dropdown arrow is expected for the popup.

    Thanks,
    Unni
    Wednesday, April 1, 2009 6:25 AM
    Moderator
  • Hello,

    My goal is to code a DialogPropertyValueEditor . So, I first create the MimicSelectionEditor class deriving from DialogPropertyValueEditor class :

    public class MimicSelectionEditor : DialogPropertyValueEditor 
     {
        private static readonly ResourceDictionary resources = FileTable.GetResourceDictionary(@"resources/editorresources.xaml");
        private static string InitialDirectory;
    
        #region Fields
    
        private ICommand editCommand;
    
        #endregion
    
        /// <summary>
        /// Constructeur
        /// </summary>
        public MimicSelectionEditor()
        {
          var dt = resources["MimicEditorTemplate"] as DataTemplate;
    
          
    
          this.InlineEditorTemplate = dt;
        }
    
    ...
    }

    Then, I describe the InlineEditorTemplate DataTemplate in my editorresources.xaml file :

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Design="clr-namespace:RSI.OTS.Engine.Design"
        xmlns:PropertyEditing1="clr-namespace:Microsoft.Windows.Design.PropertyEditing;assembly=Microsoft.Windows.Design.Interaction"
        xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
        >
        
        <DataTemplate x:Key="MimicEditorTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
              
                <TextBox Grid.Column="0" Text="{Binding Value}"/>
                <PropertyEditing1:EditModeSwitchButton Grid.Column="1"/>
            </Grid>
        </DataTemplate>
    
    ...
    

    In order to process the EditModeSwitchButton click , i override the ShowDialog method found in the DialogPropertyValueEditor class :

       /// <summary>
        /// Affichage de la boite de configuration
        /// </summary>
        /// <param name="propertyValue"></param>
        /// <param name="commandSource"></param>
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
          ...
        }
     

    That's all !

    Results :
    In Blend 2, EditModeSwitchButton control is displayed as a button : Ok
    In Blend 3, EditModeSwitchButton  is displayed as a dropdown arrow...

    Then, I try to customize the EditModeSwitchButton aspec with Styles & Template xaml code, but it fails too ... :-(

    Thanks for your future response,

    Fred





    In order to open my custon dialog box, I use a "EditModeSwitchButton" control in my xaml template file. The, I override the in order to
    Wednesday, April 1, 2009 8:53 AM
  • I see. How about you use a regular button instead, in the inline editor data template? Something like the following. The DataContext of the dialog that Blend creates for you using the DialogEditorTemplate data template will have its DataContext set to PropertyValue.

    Thanks,
    Unni

     

     

    <DataTemplate x:Key="DialogEditorInlineTemplate">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <Button x:Name="InvokeEditorButton" Content="..." Margin="4,0,0,0" Grid.Column="1" Command="{x:Static PropertyEditing:PropertyValueEditorCommands.ShowDialogEditor}"/>
    </Grid>
    </DataTemplate>

    Wednesday, April 1, 2009 6:30 PM
    Moderator
  • Super Unni ! It Works !

    Thanks a lot for your help !!
    • Marked as answer by Fred POINDRON Thursday, April 2, 2009 7:05 AM
    Thursday, April 2, 2009 7:04 AM