« first day (823 days earlier)      last day (3326 days later) » 

7:49 AM
Morning
 
 
1 hour later…
9:04 AM
1
Q: Solving DataGrid inconsistent column width sizing

bonyjoeIn our application we use datagrids to layout rows filled with templated content and buttons, however a problem occurs intermittently where some of the columns will size themselves sometimes to the minimum width of the column and sometimes to the column header content width. This seems to be some...

 
 
2 hours later…
11:04 AM
I'm in
 
11:23 AM
Hey guys. can anyone help me interpret the microsoft documentation (msdn.microsoft.com/en-us/library/hh882039%28v=sql.110%29.aspx). Does the last passage in the "chapter" Considerations when Using Scopes mean that I can or can't sync two scopes (with shared columns) to the same CE database?
 
 
2 hours later…
1:02 PM
I am here.
Still need a hand Markus?
 
You should ping him.
 
first I'm going to read this dry ass text to see if I can decipher it.
@Markus My reading of it says shared rows can be updated by either table. "Scopes can be distinct or they can overlap with each other. Two scopes overlap if they share common data between them."
 
2:07 PM
mm, in the end, the question is if it's possible to have two scopes synced to the same database...
must go for today... be back tomorrow.
 
I don't see how they'd lose sync, they're sharing the same rows.
 
2:37 PM
anyone here used infragistics?
 
3:06 PM
Used to a long time ago
 
you ever have any issues with DataCharts retaining their data visually when their component visibility changes?
meaning Visible -> Hidden -> Visible = lost data on the chart, but not the model
 
3:23 PM
Does anybody know why OnItemsSourceChanged is called anytime my Grid stops rendering?
 
 
2 hours later…
5:02 PM
@BradleyDotNET look at File Explorer, you have Folders and Files. Is Folder and File a Model or a VM?
Folder would have List<Container>? where File and Folder both : Container
 
@NETscape I would say they are just business objects
You could make a VM version, and a model version, but it probably wouldn't buy you much
 
0
Q: Image handling in WPF not thread safe?

Rand RandomI am creating a Window in a different thread that's marked STA this window has a few controls and images. I than go and close this window and open another window in the main UI Thread in this I have a print dialog and use the following code to get a FixedDocumentSequence: var tempFileName = Sys...

 
soooo how do they get displayed?
by the way, morning :)
 
5:17 PM
good morning :)
And what do you mean, how do they get displayed? I'm basically saying use the same object for both VM and model purposes unless you actually have a good reason to have two versions
In the model, you might have a FileSearcher class that creates them and passes/returns them to the VM of course
 
if have file explorer opened or whatever, what is the view model / datacontext of the view
 
5:32 PM
Probably a really simple "ExplorerViewModel"
That holds a collection of Container objects
And Folder of course also has `container objects
 
I'm trying to bind in two places of my code - one is a standard TextBlock and that is working fine. The other is a Button inside a DataTemplate.

Am I correct in thinking the only difference in the bindings should be adding an 'ItemsSource' value to the ListView within which the DataTemplate is contained?
The value being bound to both places is the same and coming from the same property in my ViewModel
 
@BradleyDotNET So then you right click on the Folder, and click Delete.... where is that ICommand? in Folder? in ExplorerViewModel?
 
@James, no the data context switches to the bound item in a DataTemplate
You need to use the Root data context (via ElementName usually) or using Johans ninja binding (see the starred posts to the right).
@NETscape I would think in ExplorerViewModel. I doubt a folder could delete itself (especially since that would likely require knowledge of the parent)
 
so you double click on a folder, how does that get handled? ICommand again?
 
Yeah, I would think so. It would just set the "RootFolder" property of the VM to the selected folder
Which would be potentially easy since CommandParameter can be bound
 
5:39 PM
@BradleyDotNET Thanks, so using my example the type of binding below wouldn't be correct (ignoring for now Johan's implemenation which I will read later).
<ListView ItemsSource="{Binding Term}" x:Name="termsListContainer" Grid.RowSpan="2" SelectionMode="None">
     <ListView.ItemTemplate>
         <DataTemplate>
               <StackPanel>
                       <Button x:Name="termButton" Content="{Binding TermName, FallbackValue='Not Working'}"  Margin="5" Click="termClicked" />
              </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
 
@James Not if TermName is on the full view model
if it was on the bound item, that would be fine
 
It is on the bound item.
I don't know how to post this code malarky :-s sorry.
 
Ctrl+K
 
How do I get it to line up nicely though - it is in my code in VS
 
Very carefully :)
Its hard enough in the standard editor, its almost impossible in this one
 
5:44 PM
Haha, good to know.
So with regards to the binding. In my ViewModel I have a parameter of 'Term'. In my ViewModel my constructor calls a method which sets Term to be a instance of my Term Class which has two properties - TermName and TermDescription. This is what you mean by bound item correct?
And if this sounds like De Ja Vu I apologise - you helped with binding a lot before Christmas and then I made some changes to my code, broke it, and when I returned to try and fix it I realised that I hadn't understood the fundamentals of what you showed me (though I had!). Been going through it slower now and understanding it 'better'.
 
Not exactly, no
ItemsSouce only makes sense when bound to a collection
say a ObservableCollection<Term>
so inside the DataTemplate your data context is a given instance of Term
So if thats your setup, then you are fine
but your description doesn't sound like that
 
gahhhh its always the simplest things that dont work and take sooo long
 
Ah, ok. So Does my data have to be in an Collection to bind to a DataTemplate? Using an ObservableCollection is my aim but in my head I was trying to do it in steps. First step get test data binding to static controls, step 2 bind test data to DataTemplate controls, Step 3 bind real data (which is an ObservableCollection) to the DataTemplate.
But no, my test data is not in an observable collection. It is a single object with two properties.
 
@Julien They just appear simple
 
@BradleyDotNET @Julien Too right they do!
I can't wait until in a few years I can come back and look at some of this stuff and find it 'easy'
 
5:55 PM
@James You can do that, just don't use ListView
Since that is meant to bind to a collection
Use ContentControl for your single item
8
Q: WPF - Display single entity with a data template

Chen KinnrotI Have a data template that i use in items control, i wanna know if its possible some how to use it(the template) on single item display without the items control? if not whats the best way to do it...?

Which also has other fun uses :)
 
Ah ok, I didn't realise that was where I was going wrong - thank you. I will take a look at that now.
It seems to me that binding (for a Win App anyway) is something that worth learning properly, right? I can see myself using it everywhere.
 
Definitley
Binding is super powerful, especially once you have some practice
 
@BradleyDotNET so now you add a file to a folder... wouldn't Container have List<Container> Items ... you call Items.Add(file).. but the UI doesn't get updated because its only a List and not a OC
 
So with my Original code - if my paramater 'Term' was an observable collection, within which each item was an instance of my Term object (with the two properties TermName and TermDisplay) would that have been the correct markup?
 
@NETscape No reason you couldn't use OC. Also, I would only have Folder have that collection.
@James Yes, that would be correct with that change
 
6:00 PM
but then doesn't Folder become not a business object?
 
@BradleyDotNET Ok, cheers. I'm going to go and play with all this new knowledge and see where I get!
 
You could argue that, but I don't think the pain of selecting into/out of a VM object is worth it
 
@BradleyDotNET gotcha, and this would be something purists hate, right?
 
OC is just List with some extra interfaces implemented
Probably :)
@James Good luck!
Gotta love purists
I had a very long comment discussion a while back as to if having the view register for a VM event violated MVVM
as if it really mattered...
I still claim it doesn't, if it did, INPC would as well
 
true
 
6:07 PM
anyways, its very amusing to see what lengths people will go to for the sake of "purity"
especially when such measures actually make the code worse.
I think someone broke comment notification, I keep getting re-notified for stuff I already dismissed.
 
6:19 PM
0
A: C#: WPF MVVM Command Binding vs. Event Callback

BradleyDotNETFor that case, you have a bit of an argument. If nothing else, closing the view may be entirely view related, so a Click event handler makes sense to start with. However, I would challenge your notion that a Command is that hard to set up. Using a DelegateCommand: http://wpftutorial.net/Delegate...

Ironically enough, someone is arguing the other way today
 
@BradleyDotNET Just to Check, this would be the correct syntax for a parameter that is an ObservableCollection? It isn't any different from one that is a string other than the type?
public ObservableCollection<Term> TermsCollection
        {
            get { return _termsCollection; }
            set
            {
                _termsCollection = value;
                OnPropertyChanged();
            }
        }
 
you don't typically "set" a collection
you would just add/remove items from it
but that is appropriate if you want to be able to set it (ie: replace the entire collection)
 
6:35 PM
What Reed said :)
You only need the INPC on the setter if you intend to replace the entire collection at runtime
 
Haha, ok thanks. In this instance I am populating the entire collection on run time. It is to load my initial view with information when the app is launched.
 
6:52 PM
@BradleyDotNET so if I have File which is a combined M/VM, and it has file properties, would persisting/saving the File be handled inside file?
 
howdy
 
When my app launches I create new instance of my ViewModel and sets the View DataContext to this instance. I then have a Search Button in my View which, if clicked I want to search my Database and bring back a value. Is it correct practice for the method attached to the Search Button to create a new instance of my ViewModel and then reset the DataContext of my view to this new instance?
 
hey Mark
 
If I do that will everything bound from the original instance be affected?
 
@James Your ViewModel should have a SearchCommand in it
 
7:00 PM
I would think you need to raise the PropertyChanged events for Properties with bindings
I wanted to share a fun one with you guys! not looking for help here because in all likelihood its the api im using, and already put in a support request.... its just interesting
0
Q: Visual data errors in Infragistics xamDataChart

Mark WSo I am using Infragistics, and I am using their xamDataChart. I have this chart put into a subview on a parent view. The subviews content will change depending on what the user clicks, so the charts may or may not be visible at any given time. Currently I only add two data points to the Observab...

 
@NETscape Hmm, i'm not familiar with that, let me do some reading
@NETscape Do you mean the search Contract?
 
no, your view model should have a method that handles the search event
that method is invoked by a Command
 
nothing like backwards graphs to make a Monday complete
 
that Command is bound to your search control
 
:P
 
7:07 PM
@Julien Ah ok, I do have a method that handles search events already however I'm not familiar with Commands - more reading :-)
 
its possible that you need to switch out the data context with a new view model but i doubt it
that is a pretty weird pattern i think
generally you would just filter what is already being displayed
 
Ah, sorry - just getting used to the terminology. I think I get what you mean - let me try it out and see how I get on.
 
all i want to do is add a soap header to my web request
hours so far
gahhhh
 
7:24 PM
@James <Button Command="{Binding SearchCommand}" Content="Search" />
 
@NETscape Thank you - just looking into this now. I didn't realise before that you could go straight to the ViewModel. I had a method in my view for 'KeyDown' which then called a method in my ViewModel. This looks much better.
 
ick ;)
 
7:41 PM
@NETscape I wouldn't think so
(regarding the File behavior)
I would think that the same service that created the collection (in your model) would have a "SaveFile" function that took a File object
If we are going with those objects just being data
Again, if you want to go with the pragmatic approach, you could easily stuff that behavior in File
@James See my above linked answer for a ridiculously short opinion on commands vs events.
Sorry for the late replies, real life intervened :(
 
8:03 PM
@BradleyDotNET Thanks for the suggestion - do you have any recommendations for good tutorials for beginners for learning interfaces and commands?
 
@BradleyDotNET meaning, FileExplorerViewModel?
 
8:53 PM
James should totally start by embedding win forms controls in WPF, using views which contain views which contain views, and top if off with third party API's so he can be as confused as me
#DoItTheHardWay
 
9:19 PM
@BradleyDotNET ^ so each root item could be technically a folder. but since they have different context menu options, I'd imagine each treeview has a different ____RootItem like FavoritesRootItem, LibrariesRootItem, ComputerRootItem
so would FileExplorerViewModel have in this case, 3 Collections, one for each treeview
 
@NETscape Yeah, that seems reasonable
@James I'm not really sure you can "learn" interfaces, they are more of a design thing. "Command" is actually just a pattern that WPF has a pre-built interface for (ICommand). I would read this though: msdn.microsoft.com/en-us/library/ms752308(v=vs.110).aspx
 
and is there a way to bind commands for the contextmenu to the fileexplorerviewmodel commands?
so if you right click Favorites, and select "Collapse," it would fire FileExplorerViewModels CollapseFavoritesCommand which basically calls FavoritesRootItem.CollapseAll()
 
The context menu is weird, in that its outside the visual tree
trying to remember how I got around that
 
I think I remember seeing something with Tag awhile back
 
Ok, I got around it by binding the context menu against data that had an ICommand property
And in the template, the data context/binding works just fine of course
That data was in a static resource btw
CollectionViewSource that is
 
9:40 PM
so ContextMenu for a Folder item... the ICommands would be in FolderCommands class
and you'd pass Folder as the commandparameter
 
9:53 PM
@BradleyDotNET ^ :) ?
 
The second part make sense
A command is usually its own class, but you could put them all in a class together
 
@BradleyDotNET wahhhh, you make command its own class every time?
don't use RelayCommand?
 
I use DelegateCommand unless I need some special CanExecute stuff or state
Did you listen to the live podcast?
 
10:37 PM
not aware of one
 
10:50 PM
It was event about 30 minutes ago
presumably they'll put the recording up soon
 

« first day (823 days earlier)      last day (3326 days later) »