...
<telerik:GridViewDataColumn
Header="{Binding Path=DataContext.OwnerForm.Lang,ElementName=FormRoot,Mode=OneWay,Converter={StaticResource langconv},ConverterParameter='Name'}"
DataMemberPath="name"
/>
...
Unhandled Error is throw.
How can I solve this problem?
Thank you in advance.
FYI
1. I think the Binding Expression should work because it can be used another place both wpf and silverlight.
2. The Converter langConv return Thai Caption of Word "Name" as String.
3. Sorry for my poor english.
11 Answers, 1 is accepted
Hello Wirat Chinnan,
I am trying to reproduce the problem here , but with no success so far. Can you please give me more details on the error e.g. what exactly is the exception. Any Call stack info should be very helpfull also .
Any other info that you think my help me to reproduce the error will be appreciated .
Greetings,
Pavel Pavlovthe Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I try to make more simple example that can reproduce the error as shown below
<UserControl x:Class="HeaderBindingTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:tkgrid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
xmlns:tki="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
<StackPanel>
<TextBox x:Name="TextBox1" Text="Test" />
<TextBlock Text="{Binding Path=Text,ElementName=TextBox1}" />
<telerik:RadGridView Name="RadGridView1" ColumnsWidthMode="Auto" AutoGenerateColumns="False"
ActionOnLostFocus="CommitEdit"
UseAlternateRowStyle="True" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="{Binding Path=Text,ElementName=TextBox1}">
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</StackPanel>
</Grid>
</UserControl>
when Binding in TextBlock.Text is work but in GridViewDataColumn.Header is not work
and Exception is
Error: Unhandled Error in Silverlight Application AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 17 Position: 52] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at HeaderBindingTest.MainPage.InitializeComponent()
at HeaderBindingTest.MainPage..ctor()
at HeaderBindingTest.App.Application_Startup(Object o, StartupEventArgs e)
at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Source File: http://localhost:1097/HeaderBindingTestTestPage.aspx
Line: 0
Thank you in advance
Wirat Chinnan
FYI
- This project use Telerik version 2009.2.812.1030
Instead of setting binding directly to the header property , please try using the following XAML.
I believe this will do the trick :
<telerik:GridViewDataColumn ...> |
<telerik:GridViewDataColumn.Header> |
<TextBlock Text="{Binding Path=Text,ElementName=TextBox1}" /> |
</telerik:GridViewDataColumn.Header> |
</telerik:GridViewDataColumn> |
Sincerely yours,
Pavel Pavlov
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.
It work.
Thank you very much
Wirat Chinnan
If so please give me the code snippet.
Binding can work only on controls and since grid columns are not you cannot bind column properties.
Kind regards,
Vlad
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.
Thanks for the reply.
We are using MVVM in our application and we would like to set header values through binding.
Do you have any workarounds to achieve the same or any time frame for your next release which contains the fix for this?
Thanks
Joy
This is limitation of Silverlight in general however MS guys promised fix for Silverlight 4. Unfortunately I'm not aware of any workaround using MVVM.
All the best,
Vlad
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.
i used below code to bind the header text by propertyName. There is no error, but header will not display the text.
can you please help.....
<telerik:GridViewDataColumn ...> |
<telerik:GridViewDataColumn.Header> |
<TextBlock Text="{Binding PropertyName}" /> |
</telerik:GridViewDataColumn.Header> |
</telerik:GridViewDataColumn> |
Regards,
S.s
Since there is no DataContext for column headers you need to point to specific context using ElementName for example.
Sincerely yours,
Vlad
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.
It still is not getting the value in the DataColumn Header.
for the Code below:
Is anything missing.
<TextBlock x:Name="testOIL" Text="{Binding OilHeader}" Grid.Row="0"/>
<telerikGrid:RadGridView x:Name="DataLog" RowStyle="{StaticResource GridViewStyle}" IsReadOnly="True" AutoGenerateColumns="False" Grid.Row="1" CanUserFreezeColumns="False"
VerticalAlignment="Top" ItemsSource="{Binding Logs, Mode=TwoWay}" SelectedItem="{Binding LogEntry}" IsSynchronizedWithCurrentItem="true">
<telerikGrid:RadGridView.Columns>
<telerikGrid:GridViewDataColumn Width="Auto" IsReadOnly="True" DataMemberBinding="{Binding OilPressure}" DataFormatString="{}{0:F2}">
<telerikGrid:GridViewDataColumn.Header>
<TextBlock Text="{Binding Path=Text, ElementName=testOIL}" />
</telerikGrid:GridViewDataColumn.Header>
</telerikGrid:GridViewDataColumn>
</telerikGrid:RadGridView.Columns>
</telerikGrid:RadGridView>