JavaFX 2.0 render controls inside control
Asked Answered
E

1

0

I work with .net WPF. Using this library allow me to completely redesign every control. F.e. - I've button, inside button I can render table (grid) with rows and columns. Then on specific cordination in table (grid) I can render image, label or something else.

here is the example for redesign ListBoxItem

        <Style TargetType="{x:Type ListBoxItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Grid x:Name="ShortCutGrid"
                          Height="96" 
                          HorizontalAlignment="Left"                               
                          VerticalAlignment="Top" 
                          Width="96"                              
                          Background="Transparent">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="96"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Grid Grid.Row="0">
                                    <Image Grid.Column="1" Name="Image1" Width="48" Height="48" Source="{Binding Path=ImageName}"/>
                                </Grid>
                                <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">
                                    <Label>
                                        <TextBox Background="Transparent" 
                                                 x:Name="TextBox1" 
                                                 Text="{Binding Path=Text}" 
                                                 Foreground="Black" 
                                                 TextWrapping="WrapWithOverflow" 
                                                 TextAlignment="Center"
                                                 BorderThickness="0"
                                                 IsReadOnly="True"
                                                 Focusable="False"
                                                 Cursor="Arrow">
                                        </TextBox>
                                    </Label>
                                </StackPanel>
                            </Grid>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="TextBox1" Property="Background" Value="Navy"/>
                                <Setter TargetName="TextBox1" Property="Foreground" Value="White"/>
                                <Setter TargetName="Image1" Property="OpacityMask" Value="{StaticResource ShortcutSelected}"/>                                    
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <EventSetter Event="MouseDoubleClick" Handler="listBoxItem_DoubleClick" />
        </Style>

My question is : Is possible in JavaFX 2.0 to render controls inside another control in fxml?

Elate answered 24/11, 2011 at 7:6 Comment(0)
O
0

With the basic controls, it isnt. But you can compose your own controls which can contain contains any node.

Ottilie answered 25/11, 2011 at 17:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.