how to bind an image to RadImageEditorUI in WPF?

3 posts, 0 answers
  1. Enric
    Enric avatar
    32 posts
    Member since:
    Apr 2013

    Posted 09 Sep 2013 Link to this post

    hi there,

    I'm loading a bunch of JPG files in one ListBox and then when the final user do doble-click mouse event my aim is just load the one JPG into Telerik control.
    How can I do that??

    Private Sub ListBox_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
           Dim s As String = ""
           BodyWorkAndPaintingTool.?????????????  = TryCast(sender,ListBox).Items(0).ToString
       End Sub

      <telerik:RadImageEditorUI x:Name="BodyWorkAndPaintingTool" ContextMenuOpening="BodyWorkAndPaintingTool_ContextMenuOpening" Grid.ColumnSpan="4" Margin="10,49,33,10" Grid.Row="1" Grid.RowSpan="4">
                    <telerik:ImageToolsSection Header="{Resx DisenadorBlur}"  >
                        <telerik:ImageToolItem ImageKey="Resize" Text="Resize" Command="commands:ImageEditorRoutedCommands.ExecuteTool">

    Thanks in advance,
  2. Enric
    Enric avatar
    32 posts
    Member since:
    Apr 2013

    Posted 10 Sep 2013 Link to this post

    Primary platform is Windows 7 Ultimate 64 bit, Vs Studio 2012 ultimate with the last SP, Framework 4.5
    I've got referenced in my references: C:\Program Files (x86)\Telerik\RadControls for WPF Q1 2013\Binaries\WPF45\

    Well, think I found the way to do that but I get an error when debugger reach this line:

    Dim radbitmapet As New Telerik.Windows.Media.Imaging.RadBitmap(fluxeaescriure)


    Dim bmpIma As New BitmapImage
         bmpIma.UriSource = New Uri("c:\puesto\DSCN3015.jpg", UriKind.RelativeOrAbsolute)
         Dim fluxeaescriure As New WriteableBitmap(bmpIma)
         Dim radbitmapet As New Telerik.Windows.Media.Imaging.RadBitmap(fluxeaescriure)
         Me.BodyWorkAndPaintingTool.Image = radbitmapet

    I don't get the point about the error...(in spanish):

    "RadBitmap.cs not found"

    Buscando origen de 'c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\ExportExtensions\System.Windows.Media.Imaging\RadBitmap.cs'. Checksum: MD5 {2c d2 ca 6 a 1b 85 d5 4e 9c d7 46 81 cc f5 96}
    El archivo 'c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\ExportExtensions\System.Windows.Media.Imaging\RadBitmap.cs' no existe.
    Buscando 'c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\ExportExtensions\System.Windows.Media.Imaging\RadBitmap.cs' en los documentos de script...
    Buscando en los proyectos 'c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\ExportExtensions\System.Windows.Media.Imaging\RadBitmap.cs'.
    El archivo no se encontró en un proyecto.
    Buscando en el directorio 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
    Buscando en el directorio 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
    Buscando en el directorio 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
    Buscando en el directorio 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'...
    Buscando en el directorio 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...
    Buscando en el directorio 'C:\'...
    La configuración de archivos de código fuente de depuración para la solución activa indican que el depurador no pedirá que el usuario busque el archivo: c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\ExportExtensions\System.Windows.Media.Imaging\RadBitmap.cs.
    El depurador no puede encontrar el archivo de código fuente 'c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\ExportExtensions\System.Windows.Media.Imaging\RadBitmap.cs'.

  3. DevCraft banner
  4. Petya
    Petya avatar
    973 posts

    Posted 12 Sep 2013 Link to this post


    I am not quite sure I properly understand your scenario.

    First, please note that the required assembly references in order to use RadImageEditorUI are listed here.

    When it comes to binding, the Image property of RadImageEditor is of type RadBitmap. In order to create a RadBitmap based on Uri you can use one of the format providers shipped with the control. 

    For example, here is how to create a stream and import it with one of the format providers. Note that in this case uri is the Uri object you want to pass and extension is the extension of the respective file.
    using (Stream stream = Application.GetResourceStream(new Uri(uri, UriKind.RelativeOrAbsolute)).Stream)
        IImageFormatProvider formatProvider = ImageFormatProviderManager.GetFormatProviderByExtension(extension);
        this.ImageEditorUI.Image = formatProvider.Import(stream);

    I hope this helps! If I misunderstood your scenario please get back to us with additional details.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top