This is a migrated thread and some comments may be shown as answers.

GridView

1 Answer 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 11 Jun 2012, 11:27 AM

Hi,

i found this example to change the CellTemplate. This works fine, but how do i insert a "Passwordbox"?

<telerik:RadGridView x:Name="RadGridView" AutoGenerateColumns="False" >
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Select hobby" />
                <telerik:GridViewDataColumn  >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadComboBox ItemsSource="{Binding AvailableHobbies}" >
                                <telerik:RadComboBox.SelectionBoxTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Owner.Choices}" />
                                    </DataTemplate>
                                </telerik:RadComboBox.SelectionBoxTemplate>
                                <telerik:RadComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}"
                     Content="{Binding Description}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </telerik:RadComboBox.ItemTemplate>
                            </telerik:RadComboBox>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Choices}" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

With Passwordbox:

<DataTemplate>
      <StackPanel Orientation="Horizontal">
           <Passwordox Name="Password_txt"  Password="{Binding Password}"  />
      </StackPanel>
</DataTemplate>

binding does not work, but why? A simple Textbox ist working fine with this Binding!
Thanks Best Regards
Rene

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 11 Jun 2012, 11:36 AM
Hi,

PasswordBox's Password property is not a dependency property, so that one cannot bind it to a property of his/her ViewModel. Here is a thread from the .NET community forum that sheds some more light on best practices when using PasswordBox.

All the best,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
GridView
Asked by
ITA
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or