Metoda DataRepeater.EndResetItemTemplate —
Kończy blok kodu, który umożliwia zresetowanie ItemTemplate dla DataRepeater kontroli.
Przestrzeń nazw: Microsoft.VisualBasic.PowerPacks
Zestaw: Microsoft.VisualBasic.PowerPacks.Vs (w Microsoft.VisualBasic.PowerPacks.Vs.dll)
Składnia
'Deklaracja
Public Sub EndResetItemTemplate
public void EndResetItemTemplate()
public:
void EndResetItemTemplate()
member EndResetItemTemplate : unit -> unit
public function EndResetItemTemplate()
Uwagi
Tej metody należy użyć, gdy chcesz zresetować właściwości ItemTemplate w czasie wykonywania.Ta metoda musi być poprzedzona BeginResetItemTemplate metodę, aby otworzyć bloku.
Przykłady
W poniższym przykładzie pokazano sposób wywoływania BeginResetItemTemplate i EndResetItemTemplate metod w LayoutStyleChanged nawet program obsługi DataRepeater kontroli.W tym przykładzie wymaga DataRepeater formantu o nazwie DataRepeater1 na formularzu i że zawiera on dwa TextBox formanty o nazwie TextBox1 i TextBox2.
Private Sub DataRepeater1_LayoutStyleChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles DataRepeater1.LayoutStyleChanged
' Call a method to re-initialize the template.
DataRepeater1.BeginResetItemTemplate()
If DataRepeater1.LayoutStyle =
PowerPacks.DataRepeaterLayoutStyles.Vertical Then
' Change the height of the template and rearrange the controls.
DataRepeater1.ItemTemplate.Height = 150
DataRepeater1.ItemTemplate.Controls(TextBox1.Name).Location =
New Point(20, 40)
DataRepeater1.ItemTemplate.Controls(TextBox2.Name).Location =
New Point(150, 40)
Else
' Change the width of the template and rearrange the controls.
DataRepeater1.ItemTemplate.Width = 150
DataRepeater1.ItemTemplate.Controls(TextBox1.Name).Location =
New Point(40, 20)
DataRepeater1.ItemTemplate.Controls(TextBox2.Name).Location =
New Point(40, 150)
End If
' Apply the changes to the template.
DataRepeater1.EndResetItemTemplate()
End Sub
private void dataRepeater1_LayoutStyleChanged_1(object sender, EventArgs e)
{
// Call a method to re-initialize the template.
dataRepeater1.BeginResetItemTemplate();
if (dataRepeater1.LayoutStyle == DataRepeaterLayoutStyles.Vertical)
// Change the height of the template and rearrange the controls.
{
dataRepeater1.ItemTemplate.Height = 150;
dataRepeater1.ItemTemplate.Controls["TextBox1"].Location = new Point(20, 40);
dataRepeater1.ItemTemplate.Controls["TextBox2"].Location = new Point(150, 40);
}
else
{
// Change the width of the template and rearrange the controls.
dataRepeater1.ItemTemplate.Width = 150;
dataRepeater1.ItemTemplate.Controls["TextBox1"].Location = new Point(40, 20);
dataRepeater1.ItemTemplate.Controls["TextBox2"].Location = new Point(40, 150);
}
// Apply the changes to the template.
dataRepeater1.EndResetItemTemplate();
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.
Zobacz też
Informacje
Przestrzeń nazw Microsoft.VisualBasic.PowerPacks