<
telerik:TreeColumnDefinition
MemberBinding
=
"{Binding WBS}"
Header
=
"WBS"
ColumnWidth
=
"60"
>
<
telerik:TreeColumnDefinition.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding WBS}"
/>
</
DataTemplate
>
</
telerik:TreeColumnDefinition.CellTemplate
>
</
telerik:TreeColumnDefinition
>
args.DragVisual = new ContentControl { Content = MyImage, Width = 25, Height = 25 };This image always shows up at a certain position relative to the cursor. Can I influence this position? I tried DragVisualOffset but - maybe I used it incorrect - that didn't result in a change of position. Thanks in advance, Vincent
<
Grid
>
<
telerik:RadGridView
x:Name
=
"Tools"
Marin
=
"0"
LoadingRowDetails
=
"ToolsLoadingRowDetails"
ItemsSource
=
"{Binding Tools}"
IsReadOnly
=
"True"
RowHeight
=
"45"
RowIndicatorVisibility
=
"Collapsed"
AutoGenerateColumns
=
"False"
CanUserFreezeColumns
=
"False"
CanUserResizeColumns
=
"True"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewToggleRowDetailsColumn
/>
<
telerik:GridViewDataColumn
Header
=
"Product Id"
DataMemberBinding
=
"{Binding Path=TypeOfTool}"
Width
=
"*"
/>
<
telerik:GridViewDataColumn
Header
=
"Target market"
DataMemberBinding
=
"{Binding Path=TargetMarket}"
Width
=
"3*"
/>
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView:RowDetailsTemplate
>
<
DataTemplate
>
<
telerik:RadGridView
Marin
=
"0"
LoadingRowDetails
=
"MoreInfoLoadingRowDetails"
ItemsSource
=
"{Binding Path=DataContext.MoreInfo, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
IsReadOnly
=
"True"
RowHeight
=
"45"
RowIndicatorVisibility
=
"Collapsed"
AutoGenerateColumns
=
"False"
CanUserFreezeColumns
=
"False"
CanUserResizeColumns
=
"True"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewToggleRowDetailsColumn
/>
<
telerik:GridViewDataColumn
Header
=
"More Info"
DataMemberBinding
=
"{Binding Path=MoreInfo}"
Width
=
"*"
/>
</
telerik:RadGridView.Columns
>
<
DataTemplate
>
<
telerik:RadGridView
Marin
=
"0"
LoadingRowDetails
=
"DetailedInfoLoadingRowDetails"
ItemsSource
=
"{Binding Path=DataContext.DetailedInfo, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}, AncestorLevel=2}}"
IsReadOnly
=
"True"
RowHeight
=
"45"
RowIndicatorVisibility
=
"Collapsed"
AutoGenerateColumns
=
"False"
CanUserFreezeColumns
=
"False"
CanUserResizeColumns
=
"True"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewToggleRowDetailsColumn
/>
<
telerik:GridViewDataColumn
Header
=
"Detailed Info"
DataMemberBinding
=
"{Binding Path=DetailedInfo}"
Width
=
"*"
/>
</
telerik:RadGridView.Columns
>
<
DataTemplate
>
<
telerik:RadGridView
Marin
=
"0"
LoadingRowDetails
=
"TargetInfoLoadingRowDetails"
ItemsSource
=
"{Binding Path=DataContext.TargetInfo, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}, AncestorLevel=3}}"
IsReadOnly
=
"True"
RowHeight
=
"45"
RowIndicatorVisibility
=
"Collapsed"
AutoGenerateColumns
=
"False"
CanUserFreezeColumns
=
"False"
CanUserResizeColumns
=
"True"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewToggleRowDetailsColumn
/>
<
telerik:GridViewDataColumn
Header
=
"Target Info"
DataMemberBinding
=
"{Binding Path=TargetInfo}"
Width
=
"*"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
telerik:RadGridView.RowDetailsTemplate
>
</
telerik:RadGridView
>
</
DataTemplate
>
</
telerik:RadGridView.RowDetailsTemplate
>
</
telerik:RadGridView
>
</
DataTemplate
>
</
telerik:RadGridView.RowDetailsTemplate
>
</
telerik:RadGridView
>
Again, I just wrote this by hand so it probably contains open/close tagging errors, but the overall idea should be understood.
The problematic event to bind to is the deepest one, in the example it is the "TargetInfo" GridView.
The XAML works as long as I don't bind to the LoadingRowDetails event. The moment I add the binding, the code throws the NullReferenceException
open attempt to expand the first row.
I hope I've provided enough information regarding the problem.
Thanks
Hello,
I am using CellTemplateSelector to change the color of a cell depending on its value. I found sample code on how to do this and it works well for GridViewDataColumn but I can't get it to work with GridViewExpressionColumn
I'm using the following and it works:
<telerik:GridViewDataColumn DataMemberBinding= "{Binding TotalAdjRateNew}" TextAlignment="Right" Width="100" DataFormatString="{} {0:#%}" IsReadOnly="True">
<telerik:GridViewDataColumn.Header>
<TextBlock Text="New Total Adj %" TextWrapping="NoWrap" TextAlignment="Center" />
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplateSelector>
<telerik:ConditionalDataTemplateSelector>
<telerik:DataTemplateRule Condition="TotalAdjRateNew < 0">
<DataTemplate>
<TextBlock Text="{Binding TotalAdjRateNew, StringFormat=p0}"
HorizontalAlignment="Right" Foreground="Red"/>
</DataTemplate>
</telerik:DataTemplateRule>
</telerik:ConditionalDataTemplateSelector>
</telerik:GridViewDataColumn.CellTemplateSelector>
</telerik:GridViewDataColumn>
However when I use the code below with a GridViewExpressionColumn the value is not displaying. I am not sure what the binding should be inside the DataTemplateRule.
<telerik:GridViewExpressionColumn UniqueName="TotalAdjPCT" TextAlignment="Right" Width="100"
DataFormatString="{} {0:#%}" Expression="MAN_ADJ_PCT + MOD_ADJ_PCT" IsReadOnly="True">
<telerik:GridViewExpressionColumn.Header>
<TextBlock Text="Total Adj %" TextWrapping="NoWrap" TextAlignment="Center" />
</telerik:GridViewExpressionColumn.Header>
<telerik:GridViewExpressionColumn.CellTemplateSelector>
<telerik:ConditionalDataTemplateSelector>
<telerik:DataTemplateRule Condition="MAN_ADJ_PCT + MOD_ADJ_PCT < 0">
<DataTemplate>
<TextBlock Text="{Binding TotalAdjPCT, StringFormat=p0}" HorizontalAlignment="Right"
Foreground="Red"/>
</DataTemplate>
</telerik:DataTemplateRule>
</telerik:ConditionalDataTemplateSelector>
</telerik:GridViewExpressionColumn.CellTemplateSelector>
</telerik:GridViewExpressionColumn>