DataGrid.AllowNavigation プロパティ
移動できるかどうかを示す値を取得または設定します。
Public Property AllowNavigation As Boolean
[C#]
public bool AllowNavigation {get; set;}
[C++]
public: __property bool get_AllowNavigation();public: __property void set_AllowNavigation(bool);
[JScript]
public function get AllowNavigation() : Boolean;public function set AllowNavigation(Boolean);
プロパティ値
移動できる場合は true 。それ以外の場合は false 。既定値は true です。
解説
このプロパティが false に設定されている場合、子テーブルへのリンクは表示されません。
使用例
[Visual Basic, C#, C++] AllowNavigation プロパティを、 true と false の間で切り替える例を次に示します。
' Create an instance of the 'AllowNavigationChanged' EventHandler.
Private Sub CallAllowNavigationChanged()
AddHandler myDataGrid.AllowNavigationChanged, AddressOf Grid_AllowNavChange
End Sub 'CallAllowNavigationChanged
' Set the 'AllowNavigation' property on click of a button.
Protected Sub myButton_Click(sender As Object, e As EventArgs)
If myDataGrid.AllowNavigation = True Then
myDataGrid.AllowNavigation = False
Else
myDataGrid.AllowNavigation = True
End If
End Sub 'myButton_Click
' Raise the event when 'AllowNavigation' property is changed.
Protected Sub Grid_AllowNavChange(sender As Object, 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 'Grid_AllowNavChange
[C#]
// 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.
protected 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.
protected 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");
}
[C++]
// Create an instance of the 'AllowNavigationChanged' EventHandler.
private:
void CallAllowNavigationChanged() {
myDataGrid->AllowNavigationChanged +=
new EventHandler(this, &MyDataGrid::Grid_AllowNavChange);
}
// Set the 'AllowNavigation' property on click of a button.
protected:
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.
void Grid_AllowNavChange(Object* /*sender*/, EventArgs* /*e*/) {
String* myString =
S"AllowNavigationChanged event raised, Navigation ";
bool myBool = myDataGrid->AllowNavigation;
// Create appropriate alert message.
myString = String::Concat(myString,
myBool ? S" is " : S" is not ", S"allowed");
// Show information ab->Item[Out] navigation.
MessageBox::Show(myString, S"Navigation information");
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ