views:

26

answers:

2

I have ListBox and DataTemplate

I need Set GroupBox Heigth = 300

How to do it?

<DataTemplate x:Key="data_template">
    <GroupBox Header="Категория" Width="300"  HorizontalAlignment="Stretch" x:Name="GroupBox">
    <DockPanel Tag="{Binding id}">
        <Button Click="Button_Click" DockPanel.Dock="Top" >
        <Button.Content>
            <DockPanel>
            <TextBlock Text="{Binding title}" TextWrapping="Wrap" DockPanel.Dock="Top" Padding="5"  HorizontalAlignment="Center"  Foreground="#FFB51414" />
            <l:ScrollViewerEx  VerticalScrollBarVisibility="Auto" >
                <TextBlock Text="{Binding description}" DockPanel.Dock="Top" TextWrapping="Wrap" Padding="5" IsHitTestVisible="False" />
            </l:ScrollViewerEx>
            </DockPanel>
        </Button.Content>
        </Button>
    </DockPanel>
    </GroupBox>
</DataTemplate>
A: 

What are you trying to achieve? Do you want the GroupBox Height to be changed at the runtime of your application, when some event occurred or some data has changed? If so, then what you are probably looking for is a data trigger or event trigger, which you simply need to add to your DataTemplate.

Vitalij
A: 

We had to use the converter

simply denis