View Issue Details

IDProjectCategoryView StatusLast Update
0001714NoesisGUIC# SDKpublic2020-08-11 19:18
Reporterck_russAssigned Tosfernandez 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.2 
Target Version3.0.5Fixed in Version3.0.5 
Summary0001714: Default display for a databound enum in XAML is its numeric value instead of its string value
DescriptionThis is an inconsistency between WPF and Noesis which can result in some unexpected output in cases where enums are directly output.
Tagsxaml
PlatformAny

Activities

sfernandez

sfernandez

2020-07-27 16:45

manager   ~0006543

Can you provide a test sample where you can reproduce this?

I tried with the following code and xaml and it shows the string value of the enum:

<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <TextBlock Text="{Binding State}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>

public enum EnumState
{
    First,
    Second,
    Third
}

public class EnumViewModel
{
    public EnumState State { get; set; }
}

public class EnumDisplayBehavior : MonoBehaviour
{
    void Start()
    {
        NoesisView view = GetComponent<NoesisView>();
        view.Content.DataContext = new EnumViewModel { State = EnumState.Second };
    }
}
ck_russ

ck_russ

2020-07-29 08:56

reporter   ~0006545

It does seem to work with TextBlocks. The problem appears in other controls:

    <Grid>
        <StackPanel>
            <Button Content="{Binding State}"/>
            <ContentControl Content="{Binding State}"/>
            <TextBlock Text="{Binding State}"/>
            <TextBox Text="{Binding State,Mode=OneTime}"/>
        </StackPanel>
    </Grid>

In WPF this results in:
Second
Second
Second
Second

In Noesis this results in:
1
1
Second
[*no value displayed*]
sfernandez

sfernandez

2020-07-29 11:34

manager   ~0006546

Thanks for the repro steps.

Issue History

Date Modified Username Field Change
2020-06-09 11:16 ck_russ New Issue
2020-06-09 11:16 ck_russ Tag Attached: xaml
2020-06-09 11:17 ck_russ Description Updated View Revisions
2020-07-27 11:55 sfernandez Assigned To => sfernandez
2020-07-27 11:55 sfernandez Status new => assigned
2020-07-27 11:55 sfernandez Product Version 3.0 => 3.0.2
2020-07-27 11:55 sfernandez Target Version => 3.0.4
2020-07-27 16:45 sfernandez Status assigned => feedback
2020-07-27 16:45 sfernandez Note Added: 0006543
2020-07-29 08:56 ck_russ Note Added: 0006545
2020-07-29 08:56 ck_russ Status feedback => assigned
2020-07-29 11:34 sfernandez Note Added: 0006546
2020-08-02 10:56 jsantos Target Version 3.0.4 => 3.0.5
2020-08-11 19:18 sfernandez Status assigned => resolved
2020-08-11 19:18 sfernandez Resolution open => fixed
2020-08-11 19:18 sfernandez Fixed in Version => 3.0.5