Page 1 of 1

TextBlock inside Textblock wont Bind to Data/show.

Posted: 10 May 2019, 11:03
by wyvern010
The following code works on WPF, but not in NoesisApp.
DataContext is set to the userconrol from code behind.
this works, cus it is working for other elements.

.xaml
<Grid Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center">
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="80"/>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="*"/>
  </Grid.ColumnDefinitions>
  <TextBlock Text="Room: " Style="{StaticResource TextColor}" Grid.Column="1">
    <TextBlock Text="{Binding Room[0].Name}" Style="{StaticResource TextColor}" Grid.Column="1"/>
  </TextBlock>
  <TextBlock Text="{Binding Room[0].Date}" Grid.Column="2" Style="{StaticResource TextColor}" TextAlignment="Right" Padding="20,0"></TextBlock>
</Grid>

Re: TextBlock inside Textblock wont Bind to Data/show.

Posted: 11 May 2019, 18:46
by sfernandez
This is a bug in our parser that is not able to add inner TextBlock as an inline, you should be getting an error message about that:
Can't add a 'TextBlock' to a 'InlineCollection'
In WPF the parser creates an InlineUIContainer to wrap the inner TextBlock so it can be added to the outer TextBlock. Could you please report this in our bugtracker and we will fix it in a future release?

In the meantime you can use a Run instead of a TextBlock for the inner text, I recommend to do that anyway because it is a bit more efficient:
<TextBlock Text="Room: " Style="{StaticResource TextColor}" Grid.Column="1">
    <Run Text="{Binding Room[0].Name}"/>
</TextBlock>