|
|
Cool! Thanks for the update!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No problem fella. I haven't installed it myself yet as I have too many deadlines at the mo to risk any problems. Have you gone for it yet?
Cheers,
|
|
|
|
|
Jammer wrote: Have you gone for it yet?
Applied hotfix late last night, working with XAML today...we'll see...
it may take a while to realize it's crashing less, since I never had a
reproduceable case.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Gotcha. Pre SP1 I was seeing at least a couple of crashes a day with with XAML so it's interesting to see this appear now.
|
|
|
|
|
Can anyone help me in letting me know how to bind a dataset to a listbox in a WPF XBAP application.
The dataset contains a table with two columns.
-----Have A Nice Day-----
|
|
|
|
|
You bind the DataContext of the ListBox to the DataSet and set the ItemsSouce binding with Path as the tablename
OR you directly bind the table to the ItemsSource property.
|
|
|
|
|
Hi,
Can you please provide me the code to set the ItemSource binding to the path as suggested by you.
-----Have A Nice Day-----
|
|
|
|
|
1. Setting the DataSet to the DataContext and binding the ItemsSource using binding Path.
e.g.,
In code setting the DataContext,
yourListBox.DataContext= yourDataSet;
in XAML setting ItemsSource binding,
<listbox name="yourListBox" itemssource="{Binding Path=YourTableName}">2. Setting the DataTable directly to the ListBox's ItemsSource,
yourListBox.ItemsSource = yourDataSet.Tables["YourTableName"];
|
|
|
|
|
You bind the DataContext of the ListBox to the DataSet and set the ItemsSouce binding with Path as the tablename
OR you directly bind the table to the ItemsSource property.
dharmesh
|
|
|
|
|
Databinding - if you read 100 examples you will find 100 ways to do that databinding - pick one at random and give it a try - repeat until something works.
That's what I do then I scrap the app anyway because WPF is always too slow and I am not a designer so everything looks rubbish.
|
|
|
|
|
I am new in WPF application, now i am studying WPF binding
Concept, i want to full detail of DataContext. and How can handle this
Please Give Any article path or explain yourself
Donot mistake me for this silly question
Thankyou
|
|
|
|
|
|
anishkannan wrote: I am new in WPF application
Seems like you're new to newsgroup posting as well.
You'll probably get much better results using a more specific
subject line than "Any body helpme".
We could all use that as the subject line for our posted questions
but it makes it hard for the people who want to help to pick out the topics
that match their expertise.
Just a suggestion...
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm very new to WPF so please forgive me if I've missed something obvious.
I've built a "lookless" control that inherits ComboBox. It has three dependancy properties (CountryCode, Label, and ListByName), and a ReadOnly property of DistrictList.
Whenever CountryCode changes, the Label is changed, and the DistrictList is rebuilt. (eg. Country changes from CAN to USA, Label will change from Province to State, and the list contents will change from provinces to states). When the ListByName property changes, the items in the list will flip from names, to two character codes, or back again (eg. Ontario to ON, or ON to Ontario).
In my Generic.xaml file, the ControlTemplate uses a dockpanel that contains a label and a combobox. I've bound the label Content property to the control Label property, and I've bound the combobox ItemSource to the control DistrictList property.
So far so good... I can flip between CAN and USA, and the control flips between provinces and states.
However, I also want to support a country of "Other", and when that country is chosen, the DistrictList that gets built is empty. So after building the list, I check its Count property. If it is 0, I set IsEditable to True, else I set it to False. That way, when there are no items in the list, the user can type something in, but when there are items in the list, the user can't type something in and must select something.
Changing the ComboBox's editable state is the part I can't seem to get working.
I have subs that fire when the CountryCode and ListByName depedancy properties change. Inside those subs they call a private method called LoadDistrictList. That is the method that fills the private member variable for the DistrictList property, and that sets IsEditable to true or false.
I've obviously missed something, but I'm at a loss as to what it is I've done wrong.
|
|
|
|
|
By default IsEditable is false. You could use a DataTrigger on the ComboBox to set it's IsEditable property to True when the Items count is 0.
e.g.,
<DataTrigger Binding="{Binding Path=Items.Count, RelativeSource={RelativeSource Self}}" Value="0">
<Setter Property = "IsEditable" Value="true"/ >
</DataTrigger>
|
|
|
|
|
I tried that, but I get this error:
'DataTrigger' object cannot be added to 'ComboBox'. Operation is not valid while ItemSource is in use. Access and modify elements with ItemsControl.ItemSource instead.
This is likely because my current Control Template combobox section looks as follows:
<ComboBox ItemsSource="{Binding Path=DistrictList,RelativeSource={RelativeSource TemplatedParent}}"></ComboBox>
So, I understand what you're suggesting, but I'm not quite sure how I should be coding the xaml to achieve that?
Also, for my own understanding, I'd appreciate an explanation from someone as to why setting the IsEditable property in my CodeBehind doesn't work.
|
|
|
|
|
I was able to get this working, but I don't quite understand why...
I created a new dependency property called MyIsEditable )and MyIsEditableProperty). I then added IsEditable="{Binding Path=MyIsEditable,RelativeSource={RelativeSource TemplatedParent}}" to the combobox in my Generic.xaml for my control.
Could someone explain why I can't use the IsEditable property on my control (inherited from ComboBox), directly?
|
|
|
|
|
Hi I am a beginner in the .Net 3.5. I am making a XBAP application and trying to declare the connection string in the app.config file. When i am using the same in my code I am receiving an unexpected error:
Cannot create instance of 'Page1' defined in assembly 'WpfBrowserApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Page1.xaml' Line 1 Position 7.
I am using the following in the code behind:
string conn = ConfigurationSettings.AppSettings["ConnectionString"].ToString();
DataSet dsEmployees = SqlHelper.ExecuteDataset(conn, CommandType.StoredProcedure, "sp_fetchEmployees");
lstEmployees.DataContext = dsEmployees;
Kindly help as I am stuck completely
-----Have A Nice Day-----
modified on Friday, March 13, 2009 11:16 AM
|
|
|
|
|
ConfigurationSettings.AppSettings is now obsolete. See here MSDN[^]. Instead use ConfigurationManager[^]/WebConfigurationManager as recommended.
Did you debug and see on which particular line does your application fail ?
|
|
|
|
|
I am not able to use ConfigurationManager. When I type Configuration, the automatic help only shows ConfigurationSettings.
-----Have A Nice Day-----
|
|
|
|
|
I shared you a link from MSDN which has example of it's usage - again link[^]
|
|
|
|
|
I wonder why I am not able to use ConfigurationManager instead of ConfigurationSettings, although I have used the Configuration class
-----Have A Nice Day-----
|
|
|
|
|
I'm not expert in this. XBAP run in partial-trust. You should expose your database through a web service (ASP.NET, WCF, ...). You may want to take a look at ADO.NET Data Services. Or include the SqlClientPermission (or OleDp's) but in this case the application can fail to run because this elevated permission.
Eslam Afifi
|
|
|
|
|
Yes you are true. I will have to use a web service to expose the data to the web application, XBAP from the SQL Server. But, I don't understand what was the need of this. Why was this not considered in the 2005 or earlier edition?
-----Have A Nice Day-----
|
|
|
|