本文整理汇总了C#中IScreenManager.NavigateBack方法的典型用法代码示例。如果您正苦于以下问题:C# IScreenManager.NavigateBack方法的具体用法?C# IScreenManager.NavigateBack怎么用?C# IScreenManager.NavigateBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScreenManager
的用法示例。
在下文中一共展示了IScreenManager.NavigateBack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SplitScreen
public SplitScreen(IScreenManager manager)
: base(manager)
{
Background = new BorderBrush(Color.Gray);
Button backButton = Button.TextButton(manager, "Back");
backButton.HorizontalAlignment = HorizontalAlignment.Left;
backButton.VerticalAlignment = VerticalAlignment.Top;
backButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); };
Controls.Add(backButton);
}
示例2: SplitScreen
public SplitScreen(IScreenManager manager)
: base(manager)
{
Background = new BorderBrush(Color.Gray); //Hintergrundfarbe festlegen
Button backButton = Button.TextButton(manager, "Back"); //Neuen TextButton erzeugen
backButton.HorizontalAlignment = HorizontalAlignment.Left; //Links
backButton.VerticalAlignment = VerticalAlignment.Top; //Oben
backButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); }; //KlickEvent festlegen
Controls.Add(backButton); //Button zum Screen hinzufügen
//ScrollContainer
ScrollContainer scrollContainer = new ScrollContainer(manager) //Neuen ScrollContainer erzeugen
{
VerticalAlignment = VerticalAlignment.Stretch, // 100% Höhe
HorizontalAlignment = HorizontalAlignment.Stretch //100% Breite
};
Controls.Add(scrollContainer); //ScrollContainer zum Root(Screen) hinzufügen
//Stackpanel - SubControls werden Horizontal oder Vertikal gestackt
StackPanel panel = new StackPanel(manager); //Neues Stackpanel erzeugen
panel.VerticalAlignment = VerticalAlignment.Stretch; //100% Höhe
scrollContainer.Content = panel; //Ein Scroll Container kann nur ein Control beherbergen
//Label
Label label = new Label(manager) { Text = "Control Showcase" }; //Neues Label erzeugen
panel.Controls.Add(label); //Label zu Panel hinzufügen
Button tB = Button.TextButton(manager, "TEST");
tB.Background = new TextureBrush(LoadTexture2DFromFile("./test_texture_round.png", manager.GraphicsDevice), TextureBrushMode.Stretch);
panel.Controls.Add(tB);
//Button
Button button = Button.TextButton(manager, "Dummy Button"); //Neuen TextButton erzeugen
panel.Controls.Add(button); //Button zu Panel hinzufügen
//Progressbar
ProgressBar pr = new ProgressBar(manager) //Neue ProgressBar erzeugen
{
Value = 99, //Aktueller Wert
Height = 20, //Höhe
Width = 200 //Breite
};
panel.Controls.Add(pr); //ProgressBar zu Panel hinzufügen
//ListBox
Listbox<string> list = new Listbox<string>(manager); //Neue ListBox erstellen
list.TemplateGenerator = (item) => //Template Generator festlegen
{
return new Label(manager) { Text = item }; //Control (Label) erstellen
};
panel.Controls.Add(list); //Liste zu Panel hinzufügen
list.Items.Add("Hallo"); //Items zur Liste hinzufügen
list.Items.Add("Welt"); //...
//Combobox
Combobox<string> combobox = new Combobox<string>(manager) //Neue Combobox erstellen
{
Height = 20, //Höhe 20
Width = 100 //Breite 100
};
combobox.TemplateGenerator = (item) => //Template Generator festlegen
{
return new Label(manager) { Text = item }; //Control (Label) erstellen
};
panel.Controls.Add(combobox); //Combobox zu Panel hinzufügen
combobox.Items.Add("Combobox"); //Items zu Combobox hinzufügen
combobox.Items.Add("Item");
combobox.Items.Add("Hallo");
Button clearCombobox = Button.TextButton(manager, "Clear Combobox");
clearCombobox.LeftMouseClick += (s, e) => {
combobox.Items.Clear();
list.Items.Clear();
};
panel.Controls.Add(clearCombobox);
//Slider Value Label
Label labelSliderHorizontal = new Label(manager);
//Horizontaler Slider
Slider sliderHorizontal = new Slider(manager)
{
Width = 150,
Height = 20,
};
sliderHorizontal.ValueChanged += (value) => { labelSliderHorizontal.Text = "Value: " + value; }; //Event on Value Changed
panel.Controls.Add(sliderHorizontal);
labelSliderHorizontal.Text = "Value: " + sliderHorizontal.Value; //Set Text initially
panel.Controls.Add(labelSliderHorizontal);
//Slider Value Label
Label labelSliderVertical = new Label(manager);
//Vertikaler Slider
Slider sliderVertical = new Slider(manager)
{
Range = 100,
//.........这里部分代码省略.........