HiCan you please help me with the below scenario?Right now the unboundfield label values are hard-coded but I want to bind the label text with the combo box selected value(year). Current hard coded Values:Label="2010 Annual Account Spend" Label="2011 Annual Account Spend" Label="2012 Annual Account Spend" Expected Value:I want to take the year selected in combo box and append it to"Annual Account Spend" text and display it in the column header. <igDP:UnboundField Name="PrevYearCustomerSpend" Label="2010 Annual Account Spend" BindingPath="PreviousYearServiceBudget.AnnualSpend" Visibility="Collapsed"> <igDP:UnboundField.Settings> <igDP:FieldSettings EditAsType="{x:Type sys:Decimal}" AllowEdit="False" EditorStyle="{StaticResource CurrencyEditorStyle}"> <igDP:FieldSettings.LabelPresenterStyle > <Style TargetType="{x:Type igDP:LabelPresenter}"> <Setter Property="ToolTip" Value="Annual account spend for a single mode/service. This is more than just the total spend with CHRW." /> </Style> </igDP:FieldSettings.LabelPresenterStyle> </igDP:FieldSettings> </igDP:UnboundField.Settings> </igDP:UnboundField>Thank you!
Hello,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
I am looking to do the same thing as above except in the code behind. I'm having trouble with adding the datatemplate part in the code behind.
I also need to bind to a property in the viewmodel instead of elementname.
Thanks!
Hello Jon,
Thank you for your post. I have been looking into it and I modified the sample I attached before, so now the TextBlock's Text is bound to a Property from the ViewModel. Also I can suggest you see these two links:
http://stackoverflow.com/questions/248362/how-do-i-build-a-datatemplate-in-c-sharp-code
and
http://www.codeproject.com/Articles/444371/Creating-WPF-Data-Templates-in-Code-The-Right-Way
where it is explained how to create DataTemplates in code.
Hello Stefan,
This is very old topic, but may be you still can help me.
in your example (WpfApplication1Modified.zip), if you enable FieldChooserButton
only " Annual Account Spend" text will be displayed in Field Chooser. Text from textbox with binding never displayed in Field Chooser.
if i comment <TextBlock Text=" Annual Account Spend"/> and keep just <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}},Path=DataContext.MyLabel}"/>,
Field Chooser will be with empty label.
Is there is any way to get it working?
Thanks