using datatemplate and updating ribbonbar values from code

Ribbon for WPF Forum

Posted 14 years ago by Arthur Damen
Avatar
I found out how to use a datatemplate to create a ribbonbar group set that must be used in several conceptual tabs. Only one problem. That is how can I update the textbox(see example) so that at start they already contain a certain value.
The actipro examples do not show how start values of the ribbonbar elements can be updated and if so they would probably have names their elements.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
  <Window.Resources >
    <DataTemplate x:Key="GG">
      <StackPanel Orientation="Horizontal" >
        <TextBlock>Name</TextBlock>
        <TextBox Width="100" Height="23"></TextBox>
      </StackPanel>
    </DataTemplate>
  </Window.Resources>
  <Grid HorizontalAlignment="Left" VerticalAlignment="Top" >
    <ContentControl ContentTemplate="{StaticResource GG}" ></ContentControl>
    <ContentControl ContentTemplate="{StaticResource GG}" Margin="200,0,0,0" ></ContentControl>
  </Grid>
</Window>
[Modified at 09/06/2010 07:10 AM]

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you are using the ribbon:TextBox, it supports value specification via the IValueCommandParameter. Meaning, you should be able to set it via command handlers as described in the documentation topic "Ribbon Command Model / Interaction with Value Controls".


Actipro Software Support

The latest build of this product (v24.1.2) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.