WPF - C# Desktop App - Ellipse - background depend from state

Markus Freitag 3,786 Reputation points
2020-07-25T19:37:22.457+00:00

Hello,

 <Ellipse Grid.Column="1" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100" Margin="926,664,0,0" Stroke="Black" VerticalAlignment="Top" Width="100"/>

I have a circle and would like to fill the background color green, red or yellow depending on the condition. How can I best achieve this?

  public enum ModeState
        {
            NotDefine = -1,
            Stop = 0,
            Automatic = 1,
            Wait = 2,
            Error = 3,
            Jam = 4,
            Block = 5
        }

Best regards Markus

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,783 questions
0 comments No comments
{count} votes

Accepted answer
  1. Markus Freitag 3,786 Reputation points
    2020-07-26T09:21:58.45+00:00

    Hi Peter,

    ok, good idea.

      <DataGrid Grid.Column="1"  
                      ItemsSource="{Binding View2}" 
                      IsReadOnly="True"   
                      AutoGenerateColumns="False" Margin="54,669,429,22" FontSize="18">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Slotnumber" Binding="{Binding SlotNo}"/>
                        <DataGridTextColumn Header="Materialnumber" Binding="{Binding Number}"/>
                        <DataGridTextColumn Header="Magazine quantity" Binding="{Binding Quantity}"/>
    

    How do I get this into the DataGrid? Simply add a column?
    If I am on status ModeState.Jam, how would I select the line / row so that the operator can see it. Would it be a good approach?


5 additional answers

Sort by: Most helpful
  1. Markus Freitag 3,786 Reputation points
    2020-07-26T14:30:45.16+00:00

    Looks good!
    I am in the status error, then the entire line should be selected.
    So I see all possible conditions.
    The active state is selected for the operator.
    Make a screeshot for that.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.