|
Ok, I figured it out. Put the expander inside a stackpanel whose width property was set to auto.
Cheers, --EA
|
|
|
|
|
Hi,
I am running visual studio 2010 premium with silverlight toolkit 4.
The project does not build and in references, the following dlls have yellow exclamation next to them:
1- Microsoft.Expression.Interactions
2- System.Windows.Interactivity
How can I solve these please?
Thanks
|
|
|
|
|
|
This [^] might help.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi!
I am making a full screen WPF application. Please tell me what is right way to make full screen application in one window. How to change screens/views? All views as custom controls? Or just hide elements or create them dynamically? I couldn't find the answer.
Thanks.
SXILL
|
|
|
|
|
You might actually want to look at an application block like Microsoft Prism[^].
By using this, you can divide your screen into regions and then add and remove views (xamls) from these regions based on your business requirements.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi
The RichTextBox has no Text property which to bind to show data from database..so are there workarounds to do this???
Thanks
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
This[^] thread may help you.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
It seems a hard work to bind the richtextbox...
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
jadughar wrote: It seems a hard work to bind the richtextbox
Seems dam near impossible to bind a RTB, thankfully my requirement could be met but a simple textblock and I moved on, but I spent a couple of weeks ratting around trying to find an decent solution to this and failed.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi Mycroft Holmes,
so did you use a TextBlock instead of a RTB???
But a simple texbolock can't show images, grids, calendar etc...am i right??
bye
thanks
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
jadughar wrote: But a simple texbolock can't show images, grids, calendar etc...am i right??
Absolutely you are correct, my requirements were actually extremely simple, some fancy formatting which I convinced the client to reduce to bullet points which are supported by the textblock.
Your requirement completely contradicts your initial issue, what has a text property have to do with a grid, calendar or image.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
yes..but the main step was to bind the RTB, thereafter try to inserit some custom controls.
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Certainly - Michael Sync wrote an excellent bindable version here[^].
|
|
|
|
|
I was watching the video about upcoming Silverlight 5.0. I have an app I would like to port to the web and Silverlight appears to be the perfect platform. Is this all real hype or is it as good as Microsoft describes it.
|
|
|
|
|
Roger165 wrote: the web and Silverlight appears to be the perfect platform
It basically depends on your requirements.
You might want to compare and contrast some other technologies (like ASP.Net, HTML5) etc. before selecting SL.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Thanks in advance.
Without boring you to death with all the details - I have an EF model intended to track project requests. The hierarchy is that corporate divisions have departments; the departments submit project requests. The requests have to be categorized by risk and can fall into one or more categories. This last component is represented in the database via a Many-to-Many table incorporating the RequestIDs and the RiskIDs. EF eliminates the many-to-many table and shows the association between the Request and RiskCategory entities.
I've created a WPF form that ALMOST works they way I want, showing the users the details of their requests. I'd like to add to the form a combobox within a listview, from which the users can select the categories that apply to a given request. Only the combobox will be in the ListView
So..the CollectionViewSource for the RiskCategories table is categoriesViewSource, and the CollectionViewSource for the RequestItems is named
RequestItemsRiskCategoriesViewSource
The Datacontext of the ListView itself is set to RequestItemsRiskCategoriesViewSource, and the combobox's ItemsSource is set to the categoriesViewSource. Try as I might, I can only get the combox to display the available RiskCategories, not the ones already assigned to the current RequestItem. If there is one category assigned, then one combobox hows in the listview. If 3, then 3 comboxes appear. But each one displays the first category in the list, not the assigned categories.
Changing the datatemplate to a Textbox bound to Category works just fine, but gives the user no way to choose a valid value
<ListView.View>
<GridView>
<GridViewColumn x:Name="categoryColumn" Header="Category" Width="80">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox
ItemsSource="{Binding Source={StaticResource categoriesViewSource}}"
SelectedValue="{Binding Path=RiskCategory}"
DisplayMemberPath="Category">
</ComboBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
[edit] - I posted XAML from a listview, not a datagridview. I can get the listview to work, but not a datagridview
Any ideas what I'm doing wrong? Do I have to handle M-M relationships differently?
Thanks again
modified on Wednesday, December 8, 2010 3:22 PM
|
|
|
|
|
Are you using a viewmodel to supply data to the view? If the datacontext of the view is the viewmodel, you might have to use a relative source to access the proper data context.
ex:
<ComboBox
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}},Path=DataContext.DocRefTypes}"
DisplayMemberPath="Type"
SelectedValuePath="Id"
Grid.Row="2"
Grid.Column="1"
Margin="5,1,4,1"
Width="395"
SelectedValue="{Binding ReferenceType}"
HorizontalAlignment="Left"/>
It really depends on the data context for the container of your control, but if the parent container or control has a datacontext set on a viewmodel, this might work for you. Change the Path to point to whatever the ObserveableCollection(?) that you are trying to bind to.
Cheers, --EA
|
|
|
|
|
Thanks for the response. I'm a part time 'programmer' trying to learn C# and WPF after years (and years) of Excel VBA and some T-SQL. The MVVM learning process has been VERY slow for me as I completely lack experience in creating and, more importantly, programming with POCO classes. All my past work that required data access used direct connections to the db and calls to stored procedures.
So, in a long winded fashion I'm replying that this WPF attempt is not using MVVM concepts and I'm trying to databind to EF EntitySets and EF entities.
Because of the issue in the original question and some other problems, I've paused the project while trying to get some MVVM education. Still am struggling to find any non-trivial examples/explanations of how one goes from EF or LinqToSQL to MVVM models. While there is a tremendous amount of quality MVVM information available, here and elsewhere, there seems to be an ongoing assumption that the readers are well versed in getting from a database datastore all the way through the construction of the models. I see very little discussion about what concepts are important to incorporate, what the approach should be, etc.
Again, thanks for your response. Maybe I'll be back after making progress on the MVVM front.
|
|
|
|
|
I define some listview that each row contain 2 button.
Each button contain text that exist in the sql server database.
I want to bind the button text to the database - but i don't know how to do it because of the special listview structure.
|
|
|
|
|
The simplest way to do this is to create a DataTemplate as I demonstrate in this[^] article.
|
|
|
|
|
Yanshof wrote: I want to bind the button text to the database - but i don't know how to do it because of the special listview structure
Very briefly, you need to get data back from the database (via a web service) and then the ListBox's itemsource to a collection.
The button's can then be bound to the properties within the collection.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
In the winforms apps I could load the data on demand because it was nice and synchronous and it only loaded when the app required the data and then held it in a static class for the duration of the app.
This all falls apart when we move to silverlight, at the moment I have a viewmodellocator that creates static viewmodels and the 'static' data is loaded upon application start, 6-10 asynchronous calls are made to the database to get the data to support comboboxes etc. This can result in state clashes as the service tends to lose the plot.
I am looking at implementing a queued process where each call waits for the previous to complete before jumping the service. We are using the Galasoft messaging to manage comms between the viewmodels so it is a fairly simple process.
Any better suggestions on how to handle this issue will be appreciated.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I would do the data retrieval at app starup, and defer EVERYTHING else until that's completed. I know it kind breaks your tidy MVVM stuff, but hey, those are just guidelines, right?
Our silverlight app makes half a dozen or so calls to a web service before anything else is done (and for the same reasons as yours).
.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
|
|
|
|
|
John Simmons / outlaw programmer wrote: Our silverlight app makes half a dozen or so calls to a web service before anything else is done
Mine is doing the same, that are all asynch of course so I'm getting some errors where the state of the object (the service) won't process the request. I presume this is caused by the half dozen asynch calls all being fed in at the same time.
So do you put up a progress indicator while loading the static data.
Never underestimate the power of human stupidity
RAH
|
|
|
|