This is a migrated thread and some comments may be shown as answers.
1 Answer 20 Views
This is a migrated thread and some comments may be shown as answers.
Voss Grose
Top achievements
Rank 1
Voss Grose asked on 20 Oct 2009, 10:12 PM
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" />

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 23 Oct 2009, 01:02 PM
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.
Asked by
Voss Grose
Top achievements
Rank 1
Answers by
Telerik team
Share this question