DataGrid.AllowNavigation Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft einen Wert ab, der angibt, ob die Navigation zulässig ist, oder legt diesen fest.
public:
property bool AllowNavigation { bool get(); void set(bool value); };
public bool AllowNavigation { get; set; }
member this.AllowNavigation : bool with get, set
Public Property AllowNavigation As Boolean
Eigenschaftswert
true
, wenn die Navigation zulässig ist, andernfalls false
. Der Standardwert ist true
.
Beispiele
Im folgenden Codebeispiel wird die AllowNavigation Eigenschaft zwischen dem und false
dem true
.
private:
// Create an instance of the 'AllowNavigationChanged' EventHandler.
void CallAllowNavigationChanged()
{
myDataGrid->AllowNavigationChanged += gcnew EventHandler( this, &MyDataGrid::Grid_AllowNavChange );
}
// Set the 'AllowNavigation' property on click of a button.
private:
void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( myDataGrid->AllowNavigation == true )
myDataGrid->AllowNavigation = false;
else
myDataGrid->AllowNavigation = true;
}
// Raise the event when 'AllowNavigation' property is changed.
private:
void Grid_AllowNavChange( Object^ /*sender*/, EventArgs^ /*e*/ )
{
String^ myString = "AllowNavigationChanged event raised, Navigation ";
bool myBool = myDataGrid->AllowNavigation;
// Create appropriate alert message.
myString = String::Concat( myString, myBool ? (String^)" is " : " is not ", "allowed" );
// Show information about navigation.
MessageBox::Show( myString, "Navigation information" );
}
// Create an instance of the 'AllowNavigationChanged' EventHandler.
private void CallAllowNavigationChanged()
{
myDataGrid.AllowNavigationChanged +=
new EventHandler(Grid_AllowNavChange);
}
// Set the 'AllowNavigation' property on click of a button.
private void myButton_Click(object sender, EventArgs e)
{
if (myDataGrid.AllowNavigation == true)
myDataGrid.AllowNavigation = false;
else
myDataGrid.AllowNavigation = true;
}
// Raise the event when 'AllowNavigation' property is changed.
private void Grid_AllowNavChange(object sender, EventArgs e)
{
string myString = "AllowNavigationChanged event raised, Navigation ";
bool myBool = myDataGrid.AllowNavigation;
// Create appropriate alert message.
myString = myString + (myBool ? " is " : " is not ") + "allowed";
// Show information about navigation.
MessageBox.Show(myString, "Navigation information");
}
' Create an instance of the 'AllowNavigationChanged' EventHandler.
Private Sub CallAllowNavigationChanged()
AddHandler myDataGrid.AllowNavigationChanged, AddressOf Grid_AllowNavChange
End Sub
' Set the 'AllowNavigation' property on click of a button.
Private Sub myButton_Click(ByVal sender As Object, ByVal e As EventArgs)
If myDataGrid.AllowNavigation = True Then
myDataGrid.AllowNavigation = False
Else
myDataGrid.AllowNavigation = True
End If
End Sub
' Raise the event when 'AllowNavigation' property is changed.
Private Sub Grid_AllowNavChange(ByVal sender As Object, ByVal e As EventArgs)
Dim myString As String = "AllowNavigationChanged event raised, Navigation "
Dim myBool As Boolean = myDataGrid.AllowNavigation
' Create appropriate alert message.
myString = myString + IIF(mybool, "is", "is not") + "allowed"
' Show information about navigation.
MessageBox.Show(myString, "Navigation information")
End Sub
Hinweise
Wenn diese Eigenschaft auf false
festgelegt ist, werden Links zu untergeordneten Tabellen nicht angezeigt.