How to replace the C1FlexGrid in editing



  • Hello, everyone! The target in the "Parol" column shows the "********" stars instead of the real password. At the beginning of the editing of the cell, the password shows a real password and can be ruled. Once the password is edited, the data are retained and the stars appear again instead of the real password. How can you arrange this? (C1FlexGrid - Counterol ComponentOne, shared with DataGrid Properties and Events) I use the next code.

    <Window x:Class="TurCC.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
    <c1:C1FlexGrid
        Name="gr_CertUsers" AllowSorting="True" AutoGenerateColumns="False"
        SelectionMode="Row" AllowDragging="None" 
        GridLinesVisibility="All" AllowDrop="False"
        HeadersVisibility="Column"
        ItemsSource="{Binding Path=CertUsersCV}"
        SelectedItem="{Binding Path=SelectedCertUser, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
        CellEditEnded="gr_CertUsers_CellEditEnded"
        PrepareCellForEdit="gr_CertUsers_PrepareCellForEdit">
        <c1:C1FlexGrid.Columns>
            <c1:Column ColumnName="UserLogin" Header="Логин" 
                Binding="{Binding Login, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
            </c1:Column>
            <c1:Column ColumnName="UserPassword" Header="Пароль"
                Binding="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
            </c1:Column>
        </c1:C1FlexGrid.Columns>
    </c1:C1FlexGrid>
    </Window>
    

    private void gr_CertUsers_PrepareCellForEdit(object sender, CellEditEventArgs e)
    {
    // думаю, здесь можно вставить в ячейку реальный пароль
    }

    private void gr_CertUsers_CellEditEnded(object sender, CellEditEventArgs e)
    {
    //думаю, здесь можно вернуть звёздочки для ячейки, вместо реального пароля
    }

    I've been in gr_CertUsers_PrepareCellForEdit to change the cell text, but it didn't work. How do you plan to change the text at the time of the editing of the cell and at the end of the editing?



  • Your "non-curricular" table of changes that occur in her ItemsSource. So when you changed the password in CertUsersCV, no changes were made. The linking of data, if you wish to be updated in a timely manner, after the changes have been made, it must be clearly stated that the sorce has changed.

    Although in your case, I would suggest that the following pattern be implemented: In the Users, the Password is divided into 2. That's MaskedPassword and DeMaskedPassword. Where get'er MaskedPassword returns DeMaskedPassword to replace all of its symbols with stars, and get'er DeMaskedPassword returns the password in a carogenic form. So the set'er only has DeMaskedPassword.

    On the trigger, the password editing began
    Change. Binding="{Binding Path=MaskedPasswordBinding="{Binding Path=DeMaskedPassword Ooh. <c1:Column ColumnName="UserPassword"Go back to the completion point.

    A similar option can also be applied not to the triggers, but to events on which you sign (PrepareCellForEdit and CellEditEnded) In this case, the Users class shall have some buoy field, depending on the value of which the ghetter returns eitherised password or disguised.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2