i want to refresh a xaml page with wpf but i dont know how can i do this...
I can't do this :
NavigationService?.Navigate(new MainWindow());
i've try this one :
this.NavigationService.Refresh();
but still not working can you help me ?
Related
So I am making a small Program where I have a UserControl inside a tab control. And i am trying to find out how to go back up a level from inside the user control to add tabs to the tab control.
Okay Thanks for the comment, I figured it out, the link posted by CarbineCoder had the following code
Form parentForm = (this.Parent as Form);
This is the code i was trying to use but what was actually needed was
Form parentForm = (this.Parent.Parent as Form);
I am subclassing ListView in a Windows Universal App Project. I create a new UserControl in Visual Studio 2015 RC and then change the UserControl type to ListView in both XAML and codebehind.
When I insert the control and run the application I get a 'Xaml Parsing Failed' exception without any further information.
Upon researching I came across the issue where the project name contains a dot, but my project name does not contain such characters.
Any Idea how to research this further?
EDIT: I also tried subclassing ListView, GridView, ListBox and Itemscontrol. Itemscontrol does not generate the error but all others do.
EDIT 2:
Created a new Universal App Project in VS2015 RC
Add -> UserControl
Changed Base Class into:
public sealed partial class ListViewEx : ListView
{
public ListViewEx()
{
this.InitializeComponent();
}
}
Changed XAML UserControl tag into ListView
The answer from MSDN forums: use themed control (custom control) for this case.
However, this approach works in WPF, it surprises me.
I am creating a Windows Phone 8.1 App and my mainpage has a Hub control that consists of one (manually created) XAML hubsection and multiple dynamic hubsections generated from JSON. I have a button that takes the user to a new page. When the user returns to the mainpage it currently shows the user the first hubsection. I am trying to make it so the user returns and sees the hubsection that was focused on before.
I attempted:
IList<HubSection> currentSections;
currentSections = mainHub.SectionsInView;
// Do your code
mainHub.SectionsInView = currentSections;
but apparently SectionsInView is readonly. I can't find anything online... is there a way to do this?
Try using Hub.ScrollToSection method or the Hub.DefaultSectionIndex property
good sirs!
I've been messing around with the next scenario:
First, I have a webform structured as a WebForm containing a DevExpress ASPXPopUpControl and some other controls. Inside the PopUpControl there is a UserControl (lets call it ucA) containing some other controls and a UserControl (called ucB) that contains a cursed ASPxHtmlEditor (added because it's a new requirement).
When the user hits a button on main webform I show the PopUp (originally was a jQuery dialog but since HTMLEditor messes up with jQuery I've been forced to break the standard and use the popup) which contains the ucA. The user fills some fields in ucA and hit the save button. After user hits, I save some dataz and at this point I need to recover a textbox value placed in the webform.
I'm using Parent.FindControl["myTextBox"] but it considers the popupcontrol as parent. When I was using jQuery (before implementing the editor) it worked like a charm.
I feel it's something trivial but thrust me when I say that this stole many hours of research.
Thanks in advance.
EDIT I forgot to mention that I want to look for another UserControl at main webform. This uc its used to display core messages to the user so when he hits the save button, save happens, popup is closed and i look (Parent.FindControl("myUCMessageBoard")) from the ucA for the usercontrol to display a "Transaction complete" message.
I'm thinking you're going to have to do something a little hacky, by using ViewState. If I understand correctly, you are trying to get access to a TextBox's Text on the Web Form, from a UserControl nested within a PopupControl (so you can't traverse all the way up to Web Form Level).
So, what I'd do at some point in the process is store the text in a ViewState variable that you can access from the User Control. It's not optimal, but since you're already hacking to get it to work, what's a little more hacking?
You should expose all controls from ucA as properties, then look for the control inside the DevxPopup the same way you doing. Given that all the controls that you need at the ucA has properties to access them, you could do all the logic you need!
Example:
public ucA : UserControl
{
public string myTextBoxText
{
get
{
return ((TextBox)Controls.FindControl("myTextBox")).Text;
}
}
/*And lot of controls*/
}
Then you looking for the popup at the Form
var ucA = (UcA)Form.Controls.FindControl("myPopup").Controls.FindControl("myucA");
ucA.myTextBoxText = /*Do stuff here with the text*/
Hopes this help you!
I have a main silverlight control named MainPage.xaml in an asp.net web site.
I want to dynamically add and remove control at run time.
So,
I have created another control Top10.xaml and added to selected canvas area on MainPage.xaml as described on this page(Click Me):
Now i need to modify Top10 visibility in MainPage.xaml dynamically when a button is clicked on MainPage.xaml using C# code in MainPage.xaml.cs.
Can anybody help me out?
Thanks
for programmability you might wanna set an id for the control u declare in xaml.
you could say x:Name="top10" or something similar.
on the click event of the button you could use the code below
top10.Visibility = Visibility.Collapsed; // to hide
top10.Visibility = Visibility.Visible; // to show
Hope this helps.