Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress bar grid bind problem #229

Closed
LucaCris opened this issue Jun 8, 2023 · 1 comment
Closed

Progress bar grid bind problem #229

LucaCris opened this issue Jun 8, 2023 · 1 comment
Assignees
Milestone

Comments

@LucaCris
Copy link

LucaCris commented Jun 8, 2023

I need to display a bar for a "priority" column:

Screenshot 2023-06-08 145105

The priority can be modified with a dialog.

If I write this code:

    <GridColumn TItem="QueueItem" HeaderText="Priority" PropertyName="Priority" >
        <Tooltip Title="@context.Priority.ToString()" Placement="TooltipPlacement.Left">
            <Progress>
                <ProgressBar Width="context.Priority" Type="ProgressType.Striped" Color="ProgressColor.Secondary" />
            </Progress>
        </Tooltip>
    </GridColumn>

...on Priority change the tooltip is automatically updated, but Width is ignored (same problem for Color). They remains as before change.

The workaround I found is a little verbose:

    <GridColumn TItem="QueueItem" HeaderText="Priority" PropertyName="Priority" >
        <Tooltip Title="@context.Priority.ToString()" Placement="TooltipPlacement.Left">
            <Progress>
                <ProgressBar Style="@ProgressPriFor(context.Priority)" Type="ProgressType.Striped" Class="@ProgressColFor(context.Priority)" />
            </Progress>
        </Tooltip>
    </GridColumn>
	
    string ProgressPriFor(int pri) => $"width: {pri}%";
    string ProgressColFor(int pri)
    {
        if (pri < 34)
            return "bg-secondary";
        if (pri < 67)
            return "bg-warning";
        return "bg-success";
    }

Is it possible to bind correctly Width and Color props?

(it happens also in modals, if a progress bar is displayed)

@gvreddy04 gvreddy04 added this to the 1.8.3 milestone Jun 12, 2023
@gvreddy04 gvreddy04 self-assigned this Jun 13, 2023
gvreddy04 added a commit that referenced this issue Jun 15, 2023
@gvreddy04
Copy link
Contributor

Changes pushed to master. This will be released in v1.8.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants