本文整理汇总了C#中TreeStore.GetNavigatorAt方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.GetNavigatorAt方法的具体用法?C# TreeStore.GetNavigatorAt怎么用?C# TreeStore.GetNavigatorAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeStore
的用法示例。
在下文中一共展示了TreeStore.GetNavigatorAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow()
{
this.Examples = ExampleLibrary.Examples.GetList().OrderBy(e => e.Category).ToList();
this.plotView = new PlotView();
this.plotView.MinHeight = 554;
this.plotView.MinWidth = 625;
this.plotView.DefaultTrackerSettings.Enabled = true;
this.plotView.DefaultTrackerSettings.Background = Xwt.Drawing.Colors.AliceBlue.WithAlpha (0.9).ToOxyColor();
this.treeView = new TreeView();
this.treeView.MinWidth = 314;
this.treeView.Visible = true;
var treeModel = new TreeStore(nameCol);
TreePosition categoryNode = null;
string categoryName = null;
foreach (var ex in this.Examples)
{
if (categoryName == null || categoryName != ex.Category)
{
categoryNode = treeModel.AddNode ().SetValue (nameCol, ex.Category).CurrentPosition;
categoryName = ex.Category;
}
treeModel.AddNode (categoryNode).SetValue (nameCol, ex.Title);
}
treeView.Columns.Add ("Example", nameCol);
this.treeView.DataSource = treeModel;
this.treeView.SelectionChanged += (s, e) =>
{
if (treeView.SelectedRow != null) {
var sample = treeModel.GetNavigatorAt (treeView.SelectedRow).GetValue (nameCol);
var info = this.Examples.FirstOrDefault(ex => ex.Title == sample);
if (info != null)
{
this.SelectedExample = info;
}
}
};
var hbox = new HBox();
hbox.Spacing = 6;
hbox.MinHeight = 554;
hbox.MinWidth = 943;
hbox.PackStart(this.treeView);
hbox.PackStart(this.plotView, true);
Content = hbox;
this.SelectedExample = this.Examples.FirstOrDefault();
this.Title = "OxyPlot.Xwt Example Browser";
this.CloseRequested += (s, a) => Application.Exit ();
}
示例2: TreeViews
public TreeViews()
{
TreeView view = new TreeView ();
TreeStore store = new TreeStore (text, desc);
view.Columns.Add ("Item", text);
view.Columns.Add ("Desc", desc);
store.AddNode ().SetValue (text, "One").SetValue (desc, "First");
store.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
.SetValue (text, "Sub two").SetValue (desc, "Sub second");
store.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
.SetValue (text, "Sub three").SetValue (desc, "Sub third");
PackStart (view);
view.DataSource = store;
Label la = new Label ();
PackStart (la);
view.SetDragDropTarget (DragDropAction.All, TransferDataType.Text);
view.SetDragSource (DragDropAction.All, TransferDataType.Text);
view.DragDrop += delegate(object sender, DragEventArgs e) {
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
var nav = store.GetNavigatorAt (node);
la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue (text) + "\" " + pos + "\n";
e.Success = true;
};
view.DragOver += delegate(object sender, DragOverEventArgs e) {
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
if (pos == RowDropPosition.Into)
e.AllowedAction = DragDropAction.None;
else
e.AllowedAction = e.Action;
};
view.DragStarted += delegate(object sender, DragStartedEventArgs e) {
var val = store.GetNavigatorAt (view.SelectedRow).GetValue (text);
e.DragOperation.Data.AddValue (val);
e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args) {
Console.WriteLine ("D:" + args.DeleteSource);
};
};
}
示例3: TreeViews
public TreeViews()
{
TreeView view = new TreeView();
TreeStore store = new TreeStore(triState, check, text, desc);
view.GridLinesVisible = GridLines.Both;
var triStateCellView = new CheckBoxCellView(triState) { Editable = true, AllowMixed = true };
triStateCellView.Toggled += (object sender, WidgetEventArgs e) =>
{
if (view.CurrentEventRow == null)
{
MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
}
else
{
store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "TriState Toggled");
}
};
var checkCellView = new CheckBoxCellView(check) { Editable = true };
checkCellView.Toggled += (object sender, WidgetEventArgs e) =>
{
if (view.CurrentEventRow == null)
{
MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
}
else
{
store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "Toggled");
}
};
view.Columns.Add("TriCheck", triStateCellView);
view.Columns.Add("Check", checkCellView);
view.Columns.Add("Item", text);
view.Columns.Add("Desc", desc);
store.AddNode().SetValue(text, "One").SetValue(desc, "First").SetValue(triState, CheckBoxState.Mixed);
store.AddNode().SetValue(text, "Two").SetValue(desc, "Second").AddChild()
.SetValue(text, "Sub two").SetValue(desc, "Sub second");
store.AddNode().SetValue(text, "Three").SetValue(desc, "Third").AddChild()
.SetValue(text, "Sub three").SetValue(desc, "Sub third");
PackStart(view, true);
Menu contextMenu = new Menu();
contextMenu.Items.Add(new MenuItem("Test menu"));
view.ButtonPressed += delegate(object sender, ButtonEventArgs e)
{
TreePosition tmpTreePos;
RowDropPosition tmpRowDrop;
if ((e.Button == PointerButton.Right) && view.GetDropTargetRow(e.X, e.Y, out tmpRowDrop, out tmpTreePos))
{
// Set actual row to selected
view.SelectRow(tmpTreePos);
contextMenu.Popup(view, e.X, e.Y);
}
};
view.DataSource = store;
Label la = new Label();
PackStart(la);
view.SetDragDropTarget(DragDropAction.All, TransferDataType.Text);
view.SetDragSource(DragDropAction.All, TransferDataType.Text);
view.DragDrop += delegate(object sender, DragEventArgs e)
{
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow(e.Position.X, e.Position.Y, out pos, out node);
var nav = store.GetNavigatorAt(node);
la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue(text) + "\" " + pos + "\n";
e.Success = true;
};
view.DragOver += delegate(object sender, DragOverEventArgs e)
{
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow(e.Position.X, e.Position.Y, out pos, out node);
if (pos == RowDropPosition.Into)
e.AllowedAction = DragDropAction.None;
else
e.AllowedAction = e.Action;
};
view.DragStarted += delegate(object sender, DragStartedEventArgs e)
{
var val = store.GetNavigatorAt(view.SelectedRow).GetValue(text);
e.DragOperation.Data.AddValue(val);
e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args)
{
Console.WriteLine("D:" + args.DeleteSource);
};
};
view.RowExpanding += delegate(object sender, TreeViewRowEventArgs e)
{
var val = store.GetNavigatorAt(e.Position).GetValue(text);
Console.WriteLine("Expanding: " + val);
};
view.RowExpanded += delegate(object sender, TreeViewRowEventArgs e)
{
var val = store.GetNavigatorAt(e.Position).GetValue(text);
//.........这里部分代码省略.........
示例4: TreeViews
public TreeViews()
{
TreeView view = new TreeView ();
TreeStore store = new TreeStore (text, desc);
view.Columns.Add ("Item", text);
view.Columns.Add ("Desc", desc);
store.AddNode ().SetValue (text, "One").SetValue (desc, "First");
store.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
.SetValue (text, "Sub two").SetValue (desc, "Sub second");
store.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
.SetValue (text, "Sub three").SetValue (desc, "Sub third");
PackStart (view, BoxMode.FillAndExpand);
view.DataSource = store;
Label la = new Label ();
PackStart (la);
view.SetDragDropTarget (DragDropAction.All, TransferDataType.Text);
view.SetDragSource (DragDropAction.All, TransferDataType.Text);
view.DragDrop += delegate(object sender, DragEventArgs e) {
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
var nav = store.GetNavigatorAt (node);
la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue (text) + "\" " + pos + "\n";
e.Success = true;
};
view.DragOver += delegate(object sender, DragOverEventArgs e) {
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
if (pos == RowDropPosition.Into)
e.AllowedAction = DragDropAction.None;
else
e.AllowedAction = e.Action;
};
view.DragStarted += delegate(object sender, DragStartedEventArgs e) {
var val = store.GetNavigatorAt (view.SelectedRow).GetValue (text);
e.DragOperation.Data.AddValue (val);
e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args) {
Console.WriteLine ("D:" + args.DeleteSource);
};
};
Button addButton = new Button ("Add");
addButton.Clicked += delegate(object sender, EventArgs e) {
store.AddNode ().SetValue (text, "Added").SetValue (desc, "Desc");
};
PackStart (addButton);
Button removeButton = new Button ("Remove Selection");
removeButton.Clicked += delegate(object sender, EventArgs e) {
foreach (TreePosition row in view.SelectedRows) {
store.GetNavigatorAt (row).Remove ();
}
};
PackStart (removeButton);
var label = new Label ();
PackStart (label);
view.RowExpanded += (sender, e) => label.Text = "Row expanded: " + store.GetNavigatorAt (e.Position).GetValue (text);
}
示例5: TreeViews
public TreeViews()
{
TreeView view = new TreeView ();
TreeStore store = new TreeStore (triState, check, text, desc);
var triStateCellView = new CheckBoxCellView (triState) { Editable = true, AllowMixed = true };
triStateCellView.Toggled += (object sender, WidgetEventArgs e) => {
if (view.CurrentEventRow == null) {
MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
}
else {
store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "TriState Toggled");
}
};
var checkCellView = new CheckBoxCellView (check) { Editable = true };
checkCellView.Toggled += (object sender, WidgetEventArgs e) => {
if (view.CurrentEventRow == null) {
MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
}
else {
store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "Toggled");
}
};
view.Columns.Add ("TriCheck", triStateCellView);
view.Columns.Add ("Check", checkCellView);
view.Columns.Add ("Item", text);
view.Columns.Add ("Desc", desc);
store.AddNode ().SetValue (text, "One").SetValue (desc, "First").SetValue (triState, CheckBoxState.Mixed);
store.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
.SetValue (text, "Sub two").SetValue (desc, "Sub second");
store.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
.SetValue (text, "Sub three").SetValue (desc, "Sub third");
PackStart (view, true);
view.DataSource = store;
Label la = new Label ();
PackStart (la);
view.SetDragDropTarget (DragDropAction.All, TransferDataType.Text);
view.SetDragSource (DragDropAction.All, TransferDataType.Text);
view.DragDrop += delegate(object sender, DragEventArgs e) {
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
var nav = store.GetNavigatorAt (node);
la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue (text) + "\" " + pos + "\n";
e.Success = true;
};
view.DragOver += delegate(object sender, DragOverEventArgs e) {
TreePosition node;
RowDropPosition pos;
view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
if (pos == RowDropPosition.Into)
e.AllowedAction = DragDropAction.None;
else
e.AllowedAction = e.Action;
};
view.DragStarted += delegate(object sender, DragStartedEventArgs e) {
var val = store.GetNavigatorAt (view.SelectedRow).GetValue (text);
e.DragOperation.Data.AddValue (val);
e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args) {
Console.WriteLine ("D:" + args.DeleteSource);
};
};
Button addButton = new Button ("Add");
addButton.Clicked += delegate(object sender, EventArgs e) {
store.AddNode ().SetValue (text, "Added").SetValue (desc, "Desc");
};
PackStart (addButton);
Button removeButton = new Button ("Remove Selection");
removeButton.Clicked += delegate(object sender, EventArgs e) {
foreach (TreePosition row in view.SelectedRows) {
store.GetNavigatorAt (row).Remove ();
}
};
PackStart (removeButton);
var label = new Label ();
PackStart (label);
view.RowExpanded += (sender, e) => label.Text = "Row expanded: " + store.GetNavigatorAt (e.Position).GetValue (text);
}