Пример #1
0
        /// <summary>
        /// Converts
        /// </summary>
        /// <param name="values">The values to convert. The first value is the command, the second value the control associated to the command.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// A System.Object that represents the converted value.
        /// </returns>
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            Debug.Assert(values.Length > 1);

            Debug.Assert(values[0] is RoutedCommand);
            RoutedCommand Command = (RoutedCommand)values[0];

            Debug.Assert(values[1] is ExtendedToolBarButton);
            ExtendedToolBarButton Ctrl = (ExtendedToolBarButton)values[1];

            return(ConvertValidValues(Command, Ctrl));
        }
Пример #2
0
        private object ConvertValidValues(RoutedCommand command, ExtendedToolBarButton ctrl)
        {
            CommandResourceReference Reference;

            switch (command)
            {
            case LocalizedRoutedCommand AsLocalizedRoutedCommand:
                Reference = AsLocalizedRoutedCommand.Reference;
                break;

            default:
                Reference = ctrl.Reference;
                break;
            }

            ImageSource Result = Reference.GetImageSource(command.Name + ".png");

            return(Result);
        }
Пример #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ExtendedToolBarItem"/> class.
 /// </summary>
 /// <param name="button">The <see cref="ExtendedToolBarButton"/> object to store.</param>
 public ExtendedToolBarItem(ExtendedToolBarButton button)
 {
     this.Button = button;
 }