Silverlight/C# project, I added an image object with a default image, the following code was created
How can I change the image when a button is clicked?
I tried this
image1.Source = new BitmapImage(new Uri("http://tpsa11/images/shi.bmp", UriKind.RelativeOrAbsolute));
but does not seem to work
I'm working on a WPF app. The DAL is behind an MVC 4 WebAPI hitting SQL.
I have a one-to-many collection of Addresses & phones. The Address object contains a list of Phone objects. Each address can contain one or many phones.
If I create the phone list using List then the UI doesn't see new phones when added. If I create the list using ObservableCollection then when I return the collection from the DAL the phones list is null. The list of phones doesn't serialize coming back from through the API.
What's wrong here? What's the right way to do this?
publicpartialclass MainWindow : Window
System.Windows.Forms.PropertyGrid grid = new System.Windows.Forms.PropertyGrid();
grid.SelectedObject = this; // Display the entire MainWindow's properties in the PropertyGrid
grid.Width = 200;
grid.Height = 100;
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
host.Child = grid;
StackPanel panel = new StackPanel();
obj.ToolTip = panel;
Don't forget to reference to System.Sindows.Forms and System.Windows.Forms.Inegration DLL-files.
In the XAML code, notice I use a Button to be the host of the ToolTip. Any recommendation for a better object to host the ToolTip?
I then create the WindowsFormsHost object to host the PropertyGrid. Finally storing the WindowsFormsHost in a StackPanel which I assign to the Button's ToolTip property.
I was not able to assign the WindowsFormsHost to the Button's ToolTip property. obj.ToolTip = host; // Will Fail
That failed and throwed an ArgumentException when I hovered the mouse curser over the button. With a StackPanel it didn't crash.
When hovering the mouse curser over the button the result is just a white box and the PropertyGrid is not visible
Iam trying to configure a service for access over both https and http from a silverlight 4 application. I am able to access the service over https but not over http. I have made some research over the net but can't seem to get the configuration right.
Below is my current settings in the my web.config file.
What do i have mis-configured above that is making the calls to the service fail on http.
I cannot access the service via http but it works fine over https. And i have a requirement to support both https and http
Please help on the approach on how will I be able to create an WPF application with requirements below:
- The tool should allow the user to open an image file and draw rectangular areas on top of it that correspond to clickable portions of the image.
- Once the rectangular areas are already placed on top of image, the app will capture the Left, Top positions and Height and Width of rectangular areas.
I do wonder what your expectations for this message are?
Create a project
add a image control to the main form
add the controls to allow the user to select an image file
place the image on the form
create the controls to begin positioning the rectangles
record the position of the rectangles.
Just like you said!
Never underestimate the power of human stupidity
Well, when do you want to call Validate? Generally, I'd say you'd call a Validate method when you leave the control. If that's the case, you don't need to call it manually, just have the control call it by itself.
I have created a class called DatePickerEx.cs that inherits from DatePicker class. Then I created a UserControl called CustomDatePicker.xaml that references the DatePickerEx.cs class in the xaml code.If I bind the "selecteddate" property in xaml at this point, it works good. So far so good.
Now, I reference the CustomDatePicker.xaml usercontrol inside another UserControl, at this point I have no way to set the "SelectedDate" property on the new UserControl called CustomDatePicker.xaml, can someone explain me how can I expose the DatePickerEx.cs->DatePicker.cs SelectedDate property via the new userControl CustomDatePicker.xaml to any other consumers of CustomDatePicker.xaml.
I need to use some kind of Dependency Property to achive this?
If you did public class DatePickerEx : DatePicker, then you'll get all the public properties and methods of DatePicker. If that's not working, you did something wrong . Not sure what since you didn't post what errors you are getting or any code.
in my application WPF/C# , i have a simple TreeView "treview1" that content for exemple:
Now i have an Class "Search.cs", and within this Class i have some methods like: advanced_serch and simpl_search , I want to be able to modified my TreeView in this two methods(advanced_serch and simpl_search).....
I am attempting to create a common WPF logon dialog. I have the dialog as a separate DLL which access a service and returns the user permissions. This works except the dialog displays as an independent window. I want to pass the main window to the dialog as the owner.
I call the logon dll from the main viewmodel
new IFALogon.LogonDlg().DoLogon(MainUI.AppID, "Finance NPA");
if (IFALogon.LogonVM.DBUser == null)
How can I pass the main view to this DLL.
Never underestimate the power of human stupidity
Hi, I am looking for ideas. Have to create controls dynamically and store values of textbox, combobox in database. Suppose I will give number 5 in existing textbox then it should create 5 textboxes and 5 combobox dynamically, all values of controls also have to save. Please share yours ideas. Thanks
That code selects the TabItem whose Tag is an int16 value that matches r.id.
The Tag property is present in many controls and is a custom user value not used by Wpf. You can use it to store an object of your choice and perform your custom logic based on it, for example save the original id such as in this code