2 posts, 0 answers
  1. Voss Grose
    Voss Grose avatar
    81 posts
    Member since:
    Sep 2012

    Posted 20 Oct 2009 Link to this post

    I changed the example DragAndDrop (first look) a little and have everything working great, but I want to be able to update the ContentControl.ContentTemplate(DataTemplate).

    I re-dedinfed the DataTemplate (below) and I'm trying to get a reference to TextBlock defined in the the DataTemplate during the execution of OnDragQuery so I can set the .Text of the TextBlock.

    DataTemplate defined (which has a TextBlock):
    <DataTemplate x:Key="ApplicationDragTemplate">
                    <Border BorderBrush="DarkGray" BorderThickness="1" Width="40" Height="40">
                            <Rectangle Width="38" Height="38" Canvas.Left="0" Canvas.Top="0" Stroke="DarkGray" Margin="0, 0, 0, 0" HorizontalAlignment="Center" VerticalAlignment="Center" UseLayoutRounding="False" RadiusY="0" RadiusX="0">
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                        <GradientStop Color="#00000000" Offset="1"/>
                            <TextBlock Text="401" FontWeight="Bold" Foreground="DarkGray" Width="35" Canvas.Left="3" Canvas.Top="2" />

  2. Miroslav
    Miroslav avatar
    922 posts

    Posted 23 Oct 2009 Link to this post

    Hello Voss Grose,

    My advice here is to bind the Text property of the TextBlock in the DataTemplate, something like:

    Text="{Binding MyProperty}"

    Then you will have to assign as Content of the ContentControl an object that has a property named MyProperty and afterwards you only need to change this object. If you want to change just this string, you can assign a string as the content:

    dragCue.Content = "402"

    and then use the empty binding in the template:


    Hopefully this will work for you,

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top