取得目前設計介面上的選取範圍。
命名空間: Microsoft.Windows.Design.Interaction
組件: Microsoft.Windows.Design.Interaction (在 Microsoft.Windows.Design.Interaction.dll 中)
語法
'宣告
Public ReadOnly Property Selection As Selection
Get
public Selection Selection { get; }
public:
property Selection^ Selection {
Selection^ get ();
}
member Selection : Selection
function get Selection () : Selection
屬性值
型別:Microsoft.Windows.Design.Interaction.Selection
Selection ,表示目前所選取的控制項。
範例
下列程式碼範例示範如何處理 Execute 事件。 它會將所選取之控制項的 Background 屬性設定為其預設值。 如需詳細資訊,請參閱逐步解說:建立功能表提供者。
' The following method handles the Execute event.
' It sets the Background property to its default value.
Sub ClearBackground_Execute( _
ByVal sender As Object, _
ByVal e As MenuActionEventArgs)
Dim selectedControl As ModelItem = e.Selection.PrimarySelection
selectedControl.Properties("Background").ClearValue()
End Sub
// The following method handles the Execute event.
// It sets the Background property to its default value.
void ClearBackground_Execute(
object sender,
MenuActionEventArgs e)
{
ModelItem selectedControl = e.Selection.PrimarySelection;
selectedControl.Properties["Background"].ClearValue();
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.Windows.Design.Interaction 命名空間
PrimarySelectionContextMenuProvider