|
Hi Samar,
From the first look of your query I will suggest you to use "DataBinding " for the ComboBox. As you are using ObservableCollection , you don't have to explicitly fire the refresh event. Once data changed in collection it will refresh implicitly. Next thing is, use Mode=TwoWay while binding to the properties inside your combobox. Use a DataTemplate to create your specific template. It will be easy for you to bind the values.
Have a look & get back to me if any issues.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Hi,
I am trying to do data binding in WPF using controls and indicators in "two" windows.
Window 1 has controls and indicators. The controls are source to properties in Window 2. When a property changes in Window 2, that property is sent back to an indicator in Window 1.
Setup:
Window 1 is comprised of normal .NET WPF objects in the form of controls and indicators. Window 2 however hosts an ActiveX control wrapped in a WindowsFormsHost object. Because of this I don't have access to the properties of the ActiveX control through XAML. So I have to use a dependency object in Window 2.
Anyone done anything like this? The norm (at least what I've found)is having all objects on one Window and having the ActiveX control complicates this. Maybe someone has the solution.
Thanks
|
|
|
|
|
Hi,
I have a problem using DataContractSerializer.
My Silverlight application asks for a web page that return an object serialized using DataContractSerializer.
When I try to deserialize the data, I obtain an empty object:
the object itself isn't null, but all the properties are set to "" for the strings or the arrays contain zero elements.
What can I do to solve this?
|
|
|
|
|
Hello everybody
I realy need help!
I have an custom multiscale image made with DeepZoom and I edit the source with Visual Studio 2010! The multiscale image it contains World map!
All I want to do is to add a custom PushPin into the map and when I move the map PushPin-s to save the position on the map!
Any ideas?
Thanks
|
|
|
|
|
|
I have the exact same problem
|
|
|
|
|
I can get all control on form in C# Windows Form App by "Control.ControlCollection coll = this.Controls"
Is there any simalar way in WPF to perform this task?
Any help would be appreciated
|
|
|
|
|
|
HI All,
DataTable data i binded to the comboBox, All values are coming correctly when i expand the combobox but after selection combobox item is coming as "System.Data.DataRowView". What's the problem. Please help me.
Sorry for my english.
Thanks in advance.
|
|
|
|
|
You need to set the DisplayMemberPath property.
|
|
|
|
|
I already set DisplayMemberPath in .cs, below is my code:
DataTable dt = new DataTable();
dt = objConnections.getAllDBNames();
cmbDBName.DataContext = dt;
cmbDBName.DisplayMemberPath = dt.Columns["name"].ToString();
cmbDBName.SelectedValuePath = dt.Columns["name"].ToString();
cmbDBName.SelectedValue = dt.Columns["name"].ToString();
in XAML:
<ComboBox x:Name="cmbDBName" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding}" SelectionChanged="cmbDBName_SelectionChanged" Margin="1,7,1,5.723" Style="{StaticResource ImageComboBox}"/>
|
|
|
|
|
Suppose I have a form like this http://www.mediafire.com/i/?7ojbjfc66aazg2o[^]. The GroupBox and Button A control contain the red point. When I click the red point, I want to get the GroupBox and Button A control, but not Button B control. The Button A is “smaller” than the GroupBox. And the control I expected when I click the red point is Button A (the smallest control).
In fact, I can getRecangle of each control to solve my problem, but it’s slow down the performance. I need a better way to increase performance.
Here is my question: is there any WPF functions help me do that?
Thank you.
|
|
|
|
|
This tip/trick might help you:
Get Mouse Click Relative Position[^]
It was written for Silverlight, but I see no reason it shouldn't work for WPF. Even if it doesn't work, you can probably get a direction as to where to look for a WPF-oriented solution.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Friday, August 20, 2010 2:46 PM
|
|
|
|
|
Hi John Simmons,
I can get all controls from one point by calling this function "Control.IsMouseOver".
Anyway, thank you very much.
|
|
|
|
|
Hi.
Is there an easy/right way to make the same project both in WPF and Silverlight?
Thanks.
David
|
|
|
|
|
For the most part, if it works in Silverlight then it'll work in WPF. Silverlight is missing some features of WPF, and has tighter security, so it's mostly a subset.
There ARE exceptions, and some third-party controls will only work with one or the other, but will often have a version for each.
EDIT: Basically, aim for Silverlight and keep an eye on any non-framework controls you use (Including the Silverlight Toolkit).
|
|
|
|
|
Thanks Ian.
After completing the Silverlight project how I convert it into WPF? I am a GUI Designer and working mostly with Expression Blend. Or I have to do it with Visual Studio?
Thanks,
David
|
|
|
|
|
Don't think I can help ya there... I tried Blend once, and never went back to it. Felt like I was programming in Photoshop.
|
|
|
|
|
Could you describe in short how you do it in VS?
Thanks,
David
|
|
|
|
|
If you didn't use any third party controls, most of what you have in Silverlight can be used without changes in WPF. Of course, there are differences, and there's no possible way we can list them all here.
I know you're gonna think this sounds harsh, but be a programmer, and work it out.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Why harsh, on the contrary, very simple:
1. Change the output type of the Project to Windows Application.
2. Replace the agclr.dll reference with references to PresentationCore.dll and PresentationFramework.dll.
3. Your main XAML window will inherit from System.Windows.Window, not Panel.
4. In your Window XAML declaration, you'll need to change 'xmlns="http://schemas.microsoft.com/client/2007"' to 'xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
5. Another option is to create a new WPF project and copying your code into it. I can't tell you which would be easier or more efficient.
6. Of course, some things will be likely be broken, but they should be minimal and easily fixed.
Enjoy your life
|
|
|
|
|
Ian Shlasko wrote: any non-framework controls you use (Including the Silverlight Toolkit).
From that I am assuming the Silverlight toolkit does not work with WPF.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Prism (Composite Application Lib) allows multi targeting of both WPF and Silverlight....has some good how-tos also
C# has already designed away most of the tedium of C++.
|
|
|
|
|
Hello
I can not work out how to find a objects ancestor in the following context.
I have a Tab control which has three Tab Items a, b and c. Each Tab Item has a frame which in turn hosts a page. Each Tab Item will host the same page.
The page contains a canvas with custom built graphical objects all inheriting framework element. I would like to make the visibility of my graphical objects dependent on the Tab Item.
For example if the page finds its ancestor of type Tab Item , name property to be "b" then only certain objects would be made visible. At initialization of the object i would like to look up the ancestor tree till i reach type Tab Item and then compare the Tab Item name to another object property and then set the visibility property.
Thanks
Dane,
|
|
|
|