|
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,
|
|
|
|
|
You didn't mention whether it was WPF or Silverlight. In WPF, you can use the VisualTreeHelper object. It exists for Silverlight as well, but I think it's less capable.
.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
|
|
|
|
|
Hmm... Off the top of my head, I think this could be solved with a couple attached properties...
Not sure how familiar you are with them, but attached properties in WPF are basically properties that are based on one class, but can actually apply to any DependencyObject of a given base type. They're most similar to the IExtenderProvider functionality in WinForms, except that they can ALSO inherit to child objects... So if you set the value on the TabItem, then all of its children can read that value too, as if it was on each of them.
1) Create two attached properties:
- a) ParentTabName, with a type of TabItem. For each tab, bind that property to the tab name ({Binding TabName,RelativeSource={RelativeSource Self}} if memory serves).
- b) TabVisibilityCodes, with a type of string. For each child control that needs to be shown/hidden, set that property to, say, a comma-delimited list of the names of tabs it should be shown on. All of this can be done in XAML once the properties are created.
2) In the setter for either property (The getters/setters are all in one place, not on each object), compare the two attached properties for the element in question, and update its visibility accordingly.
|
|
|
|
|
int _result = ((int)(base.EndInvoke("UserExist", _args, result)));
WHEN I TRY TO LOGIN
USING VS 2010 PRO/SQL DEVELOPER R2
|
|
|
|
|
|
Hello,
I have a DrawingGroup with nested children created from SVG files and want to render/convert this a corresponding nested DrawingVisual/Visual.
A simple rendering process as follows...
DrawingGroup group;
DrawingVisual visual = new DrawingVisual();
visual.DrawDrawing(group);
will correctly render the drawing graph, but the resulting visual does not contain any child visual, only a single visual with no child is created.
The children of the root drawing may also have children with transform(s), which is the may cause of my current failed attempt.
I need the nested visual to perform interactive operations. Anyone done a similar thing and will not mind to share his/her algorithm?
Paul.
Jesus Christ is LOVE! Please tell somebody.
modified on Tuesday, August 17, 2010 2:03 AM
|
|
|
|
|
I used the custom Rendering Ink to build a custom brush. I create a customized dynamic renderer that derives from the DynamicRenderer and override the OnDraw method. In OnDraw method, i need to do a lot of drawEllipse(). After that, the computer becomes very slow. Guys, do you have any solutions about that?
Thanks a lot!
|
|
|
|
|
Dear All,
I have a Page name first.aspx, from where i click on go to second.aspx. This second.aspx page has silverlight object.
In silverlight object i use
System.Windows.Browser.HtmlPage.Window.Navigate(New Uri(strUrl, UriKind.RelativeOrAbsolute), "_self", "")
to come back to first.aspx, but it works like back button of browser, means this page not showing the updates i have done in second.aspx. I have to refresh the first.aspx to see the new changes.
So how could i navigate to the page with page refresh in silverlight.
Thanks
|
|
|
|
|
HI All,
I got the solution for the same. Sharing with u
HtmlPage.Window.Eval(String.Format("window.location.href='{0}';", strUrl))
Thanks
|
|
|
|
|
Hi,
I am working on WPF browser application. i am facing below issue
how to bind different tables to wpf datagrid combobox column ?
i have wpf datagrid, in that grid 2 combo box columns are there , 1 st column is Country and second column is state, both are datagridcombo box columns only, here depend on the country column i need bind diffrent table to state column. so each row i need to bind different table to state column . so how to achieve this task?
Thanks
Sekhar
|
|
|
|
|
I have some simple .net control that i want to add into wpf window.
i trying to add it by using "choose toolbox item" that appear on the IDE - but i dont see the item => so i can't add the object to my WPF window.
How cani do it ?
Thanks for any help.
|
|
|
|