Hi,
I'm trying to use the HeaderTemplate to customize the header of the ContentPane, but I get a binding error saying that the "XXX property not found on ABC.MyViewModel"...(the usual binding error message listed in the Output window). So I know that the binding is set up correctly.
So I know for sure that my ViewModel has the property I'm trying to bind to, and binding to the ViewModel works perfectly fine except when doing it from the HeaderTemplate of the ContentPane, so I need some help figuring out what's wrong here...? Anyone had similar issues?Here's my ContentPane style;
<Style TargetType="ig:ContentPane" BasedOn=""> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Title}"/> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style>
-Thanks!
Ok, so I missed the fact that the Header property of the ContentPane is actually a string and not an object (which I expected it to be), so it explains why the binding will fail.
It would be nice if the ContentPane.Header could be an object and not a string.
It actually can't be an object. The reason is, that the Header isn't just used for the ContentPane. It's used everywhere. For example, if you put it in a TabGroupPane, the tabHeader will use that header. Or if you open up the shortcuts dialog by hitting "ctrl" + "+" the value being displayed for that pane is the ContentPane.
When its an object and not a string, it can only be displayed once in the VisualTree, otherwise you'll get an exception.
-SteveZ
Ok, thanks for the reply, I didn't know that.
So what is the best approach to "customizing" the header? Do I need to override the ControlTemplate of the ContentPane? What I want in my header, in addition to the caption and icon, is an indicator (for example a '*') that is visible if the content of the ContentPane is dirty, and a progress indicator that animates while data is being loaded / saved / processed etc (I want that progress indicator pr tab).
-Thanks
I'm not sure how you're trying to do the binding,
However, you can use the DataContext property off of the pane, via an ElementName binding.
<ig:ContentPane x:Name="cp2" DataContext="{StaticResource myDataObj}"> <ig:ContentPane.HeaderTemplate> <DataTemplate> <TextBlock Text="{Binding DataContext.FirstName, ElementName=cp2}"/> </DataTemplate> </ig:ContentPane.HeaderTemplate> <ig:ContentPane.Content> <TextBlock Text="{Binding FirstName}"/> </ig:ContentPane.Content> </ig:ContentPane>
Hi srikanthquestions,
Are you sure that you have not posted in the wrong section, because that one is for XamDockManager from Silverlight. Which platform are you using for creating your project, so that we could navigate you to the right people to help you! Thanks!
Regars,
Nikola.
Hi All,
I am currently using WebdataGrid for My project. I have a scenario like i need to add Header Columns and Header Text at Run Time.Can some one Please help me out.. its urgent
I dont find any post like assigning header text at run time
Please check my code below
btnGenerate.CommandArgument =
"1";
colT =
new TemplateDataField();
colT.Key =
"TemplateColumn" + iColCount; //set a unique key to each column
colT.Header.Text = txtStartDate.Text;
//dgAddHeaderGrid.Columns.Add(colT); //Add that column to the grid
colT.ItemTemplate =
new CustomItemTemplate(iColCount, txtStartDate.Text, txtEndDate.Text);
//Add the item template inside the Template column
dgAddHeaderGrid.Columns.Add(colT); /
/Add that column to the grid
Ok, thanks, that should work!
Also, while I have your attention, I posted a question about the XamDockManager and Prism in this thread: https://es.infragistics.com/community/forums/f/retired-products-and-controls/60532/xamdockmanager-and-prism-fails that nobody seems to have an answer to...would you mind taking a look and comment on that? Fortunately our subscription gives access to your source code, so I have been able to partially create a workaround, but I would rather not have to modify the source...but we can discuss it in the other thread or by mail.