|
Hi all
Im trying to bind two comboboxes together. I have a table called country and a table called city in SQL database. When a user selects a country in the countrycombox i want it to filter the cities that are in that country and show them on the city Combobox.
Can some one help me please.
Thanks in advance
|
|
|
|
|
hello dear,
you can add one column in country table and one coulmn in city table the name of column may be "ExamineId" in both ethe tables then in country table put integer value(1,2,3,4,5.....) for every country in "ExamineId" column.and put the corresponding number for cities in city table.
like in country table
ExamineId country
1 country1
2 country2
in city table
ExamineId city country
1 abc country1
1 xyz country1
1 wpg country1
2 ghf country2
2 yhk country2
2 poi country2
select ExaminId from country table for selectes country and take it in one string type variable say "EId".
then make query for combobox2 as
select * from city where ExamineId = EId
and put all the data in combobox2.
hope it'll help u....
sandy
|
|
|
|
|
thank you
|
|
|
|
|
This seems a ridiculous idea to solve this kind of problem- "Changing backend to render UI" !! Crazy!!!
This should be very simple one...You better do a "Google" with the search keyword- "IsSynchronizeCurrentItem in WPF" rather changing the database schema.
sdixit110 wrote: you can add one column in country table and one coulmn in city table the name of column may be "ExamineId" in both
I am wondering how people find solutions like this...BAD SOLUTIONS!!!
Moim Hossain
R&D Project Manager
BlueCielo ECM Solutions BV
|
|
|
|
|
|
This is the general logic:
<StackPanel Orientation="Horizontal" DataContext="{Binding Source={StaticResource mySource}}">
<ComboBox ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" />
<ComboBox ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" />
</StackPanel> Obviously, you need to put your binding source into the context, and the paths you want to work with (plus any item templates you see fit), but this should get you started.
|
|
|
|
|
how can i resolve this problem in xaml file when ever i try to add
<grid> --- error (element expected...)
umerumerumer
|
|
|
|
|
Provide the expected element!
Seriously, a code sample would really help us help you.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Please post your XAML code.
|
|
|
|
|
Binding a property to a setting worked:
<Window x:Class="test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prop="clr-namespace:GTOWPF"
Height="{Binding Source={x:Static prop:Settings.Default}, Path=Win1H}"
Width="300">
Binding a property inside a datatemplate:
<Window x:Class="test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prop="clr-namespace:GTOWPF"
Height="100"
Width="300">
<Window.Resources>
<DataTemplate x:Key="Test">
<Grid Height="{Binding Source={x:Static prop:Settings.Default}, Path=Win1H}">
</Grid>
</DataTemplate>
</Window.Resources>
</Window>
Doesn't work,
Only public classes can be used in markup. 'Settings' type is not public.
Any sugestions?
modified on Wednesday, January 14, 2009 11:15 AM
|
|
|
|
|
|
Thanks,
Default Access Modifier was set to Friend.
|
|
|
|
|
When i pass large amount of data through wcf it gives error of max data
Please tell how to solve this
|
|
|
|
|
Increase the maxReceivedMessageSize on the binding.
|
|
|
|
|
I keep getting the following message:
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='#FF646464'; ResourceKey.HashCode='47980820'; ResourceKey.Type='System.Windows.Media.SolidColorBrush'
How do I find out what is causing that?
|
|
|
|
|
Did you figure this out yet?
Just a wild guess, but that "ResourceKey='#FF646464'" looks like
an ARGB color associated with a ResourceKey somehow - maybe some
malformed XAML defining a brush somewhere...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
While working on a WPF app, I thought I should try and be proper, and honour the color scheme on the host system, rather than inflicting my idea of colors on to the user, and I got this error too.
I was making a ListView control template that adds a border, and hence I started to add "IsSelected" triggers to highlight focused items. The color values I used were things like:
{DynamicResource {x:Static SystemColors.HighlightColor}}
{DynamicResource {x:Static SystemColors.HighlightTextColor}}
{DynamicResource {x:Static SystemColors.ControlDarkColor}}
If I now run my app, I get a bunch of debug message like
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='#FF000000'
System.Windows.ResourceDictionary Warning: 9 : Resource not found; ResourceKey='#FFB2B4BF'
Reverting to hard coded colours removes the problem.
|
|
|
|
|
Hi,
In my WPF application I need to return a collection as return type using a PageFunction. Is it possible? If yes how do I do it?
Thanks & Regards,
Deepak.
|
|
|
|
|
In response to a recent blog entry[^] by Josh Smith where he talks about the default scope of XAML variables, and how to change them to private, I've updated MoXAML PowerToys[^] to automatically search for elements in your XAML with the x:Name attribute set (and without the FieldModifier set). Any matches automatically get x:FieldModifier="private" added to them.
|
|
|
|
|
Yay Pete!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello All!
I'm trying to test a WPF application which displays most of the information using DataTemplates. The problem that I'm facing right now is that data in the template is not visible neither by the UI Automation framework nor by the UISpy tool.
Has anyone seen this behavior?
Suggestions are appreciated.
dimaj
|
|
|
|
|
I am also facing the same problem. Seems 'Project white' or UI Automation framework for WPF is not stabilized. Seems some IBM automation test tool captures events of WPF which UISpy cannot.
|
|
|
|
|
Is it possible to assign a resource to another resource? For example, if I have a SolidColorBrush named MyBursh01, can I make a MyBrush02 that has the same values as MyBrush01, or can I make a Rectangle named Rect2 and make it = Rect1?
I am referring to making it in XAML not C#
Thanks
|
|
|
|
|
You could always use BasedOn to do this when it comes to using one style as a basis for another.
|
|
|
|
|
Hello All,
How can I use the DataGridCell Template with WPF Toolkit Datagrid. I like to create a Cell Template and like to apply that template for all cells.
For example:
<Style or something x:Key="myDGCellTemplate">
<DataTemplate>
<StackPanel>
<Button Content="AA" />
<Textbox Text={Binding .} />
</StackPanel>
</DataTemplate>
</Style or something>
<toolkit:DataGrid x:Name="myDataGrid" ItemSource="{Binding myDataSource}"
CellTempleteORSomething={StaticResource myDGCellTemplate}" AutoGenerateColumns=True>
</toolkit:DataGrid>
#2.
Can I use "." in Binding? As the column will be generated dynamically based on the Data Source, I don't know the column name. So, I want to set whatever column that I got to the textbox.
Thanks in advance.
<Textbox Text={Binding .} />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
|
|
|
|