GithubHelp home page GithubHelp logo

Comments (4)

 avatar commented on May 17, 2024

Hello grizoood, thank you for your interest in Windows Community Toolkit!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible.. Other community members may also answer the question and provide feedback ๐Ÿ™Œ

from dotnet.

michael-hawker avatar michael-hawker commented on May 17, 2024

Thanks for providing more details @grizoood, didn't see this initially when I responded to your discussion here.

Going to transfer this to the .NET Community Toolkit repo where the MVVM Toolkit lives. FYI @Sergio0694

from dotnet.

Sergio0694 avatar Sergio0694 commented on May 17, 2024

Hi @grizoood! Would you be able to provide us a minimal repro? That would help us a lot to investigate this. By that I mean the minimum possible amount of code that can reproduce the issue (eg. literally just a single control in XAML with just a line for a binding, and the smallest viewmodel you can get, with like a single property and the minimum amount of validation possible, no comments, no extra code, etc.). Additionally, does the issue only happen with that custom setter you have, or can you also repro with eg. a TextBlock binding its text? Thanks! ๐Ÿ™‚

from dotnet.

grizoood avatar grizoood commented on May 17, 2024

Sorry for the late reply, I put the issue on hold.

Validation works if I add a null style to hide cell validation:

Validation.ErrorTemplate" Value="{x:Null}"
<DataGridTemplateColumn.CellStyle>
    <Style TargetType="{x:Type DataGridCell}">
        <Style.Resources>
            <Style TargetType="{x:Type ContentPresenter}">
                <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
            </Style>
        </Style.Resources>
    </Style>
</DataGridTemplateColumn.CellStyle>

Before: I have 2 borders (DataGridCell and TextBox)
image

Aprรจs: I have 1 border (TextBox)
image

<DataGridTemplateColumn Header="Start DataGridTemplateColumn (TextBox)">
    <DataGridTemplateColumn.CellStyle>
        <Style TargetType="{x:Type DataGridCell}">
            <Style.Resources>
                <Style TargetType="{x:Type ContentPresenter}">
                    <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
                </Style>
            </Style.Resources>
        </Style>
    </DataGridTemplateColumn.CellStyle>
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBox Text="{Binding Start, UpdateSourceTrigger=PropertyChanged}" Margin="5">
                <TextBox.Style>
                    <Style TargetType="TextBox">
                        <Style.Triggers>
                            <Trigger Property="Validation.HasError" Value="true">
                                <Setter Property="ToolTip" Value="{Binding (Validation.Errors)/ErrorContent, RelativeSource={RelativeSource Self}}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </TextBox.Style>
            </TextBox>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

I didn't have the problem with the DataGridTextColumn because I was directly modifying the cell style of the DataGridTextColumn but not for the DataGridTemplateColumn.

from dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.