« first day (949 days earlier)      last day (3200 days later) » 

6:56 AM
I am new to this chat room .. I have a question and I need some help .. my problem is that I have a SearchBox control in my windows 8.1 app, I am unable to set focus on the SearchBox, I tried the following code but its not working.
private void SearchBox_FullView_PointerPressed(object sender, PointerRoutedEventArgs e)
{
SearchBox_FullView.Focus(FocusState.Programmatic);
}
 
 
3 hours later…
9:28 AM
anyone knows about MATLAB
i've a question about it
 
 
5 hours later…
2:00 PM
oi
 
2:56 PM
posted on May 26, 2015 by ericlippert

I briefly discussed copy-paste errors in code earlier; though this is a rich area of defects that I will probably at some point go into more detail on, that’s not for today. Though this is a trivial little issue, I … Continue reading →

 
3:15 PM
Morning
When one of you guys are around, would you mind giving me some advice on Value converters?
im kind of at a loss as to how im supposed to use this....
 
3:30 PM
//***kms not unique vals
public enum ENetworkAuthentication
{
WEP_None = 0,
WEP_Shared = 1,
WPA_PSK = 2,
WPA2_PSK = 2
};


^ screw you KMS....
what kinda stupid ass enum is that
 
DateTimeFormatInfo.CurrentInfo.MonthNames gives you an array of 13 items
nice
 
lol Java Datetime months start at zero, so I feel ur pain
 
 
1 hour later…
5:05 PM
sup?
 
hey
If you make a copy of a Dataobject like so:
m_Records = new ObservableCollection<DataRecord>(_records);
 
@MarkW you can get the string version on the enum in the converter if you'd like
 
Where _records is an array of objects
Will the bindings still work as expected?
 
switch(entwkAuth)
{
    case WPA_PSK:
    case WPA2_PSK:
        switch(entwkAuth.ToString()) // assuming if entwkAuth == WPA_PSK doesn't work
        {

        }
}
@Asheh no, the objects just get copied to a new collection. So updating _records won't update m_Records
 
What about if you bind to a property on an individual record
(not worried about the collection)
 
5:09 PM
the binding should stay in tact... assuming you're not breaking other bindings
 
:( why doesn't it work!
 
because you're setting m_Records =
are you binding to m_Records?
 
m_Records[0]
Basically I bind to an array inside Record
but the view is shown, before that array is generated
Once that array is generated, I want it to propegate, but it doesn't
I guess this is is threading issues again :@
 
5:24 PM
@NETscape ive found it
YES!!!! IT WORKS I have come across a hidden gem!
29
Q: How do I update an ObservableCollection via a worker thread?

MaciekI've got an ObservableCollection<A> a_collection; The collection contains 'n' items. Each item A looks like this : public class A : INotifyPropertyChanged { public ObservableCollection<B> b_subcollection; Thread m_worker; } Basically, it's all wired up to a WPF listview + a details vi...

 
I would add that if you add many items you only want to do one Dispatcher.BeginInvoke and loop inside it.
 
 
2 hours later…
7:23 PM
hi guys, I need a suggestion
I am writing a WPF application which does some time consuming tasks should I do this in Threads or Tasks?
 
dont forget about background worker
 
Tasks - that makes it much easier (provided you're using .NET 4.5/C# 5) to tie into your UI via async/await
 
you mean backgrund worker thread?
 
there's really no reason to ever use new Thread anymore - always prefer Task/Task<T>
He means BackgroundWorker - which was the best option in .NET 2 for background work
 
how to update the UI with tasks??
 
7:27 PM
personally, I think Task/Task<T> is much easier with async/await now
depends on what you're doing in the background
 
App.Current.Dispatcher.Invoke((Action)(() =>{}));
I used this to update the UI
how do I update the UI with tasks?
or would I need to update the UI at all?
 
you don't need to do that if you design things properly using async/await and Tasks
 
oh cool
Is there a good example to follow?
 
thanks
 
7:33 PM
:p
first link is a good one, actually
 
zomg that link is a virus! it takes over your keyboard!
 
:D Quick, quick, flag me!
 
8:08 PM
hey
Can anyone advise how I should set the data context of this View? gist.github.com/BrianJVarley/87a051d400ea1c7ffcfb when the associated ViewModel's constructor takes a List of type ScoreModel in it's constructor, gist.github.com/BrianJVarley/7bb73aeae86459d9983f
What I thought would work, is specifying the same parameters that are passed into the VM, in the View's code behind constructor
            ViewModel = new ViewSubjectGradeViewModel(IEnumerable < ScoreModel > addedSubjectGradePairs);
 
Use DataTemplates and a ContentPresenter, and let WPF wire up the view
ie: go VM first instead of View first
so the View doesn't create the DataContext
(it's what I do most of the time anyways :p )
 
ok thanks for the advice, give me a min to process that :)
It's Windows Universal btw, should that be any different than WPF?
 
nah, should work the same
I talk about that approach at reedcopsey.com/2010/01/06/…
 
So basically I'm going to be setting the data context for this View in the xaml, not the code behind?
 
yeah - because then you can just set the VM as a property on your main VM, and have it bind
 
8:23 PM
okay sounds intriguing
 
I tried to write a markupconverter with bindable parameters today but failed. swing > miss > revert
 
so from scanning through the page, it seems I can do the following and don't have to specify the parameter that the View's VM takes
<DataTemplate DataType="{x:Type local:OurViewModel}">
    <local:OurView />
</DataTemplate>
I don't need to do anything like:
<DataTemplate DataType="{x:Type local:OurViewModel(whatever parameter my VM takes)}">
    <local:OurView />
</DataTemplate>
just wrap my View in the DataTemplate, seems a bit too good to be true :P
and that will have set up the data context between the View and VM?
@JohanLarsson I spent all day trying to implement a Social login and share feature to my Universal app, I feel your pain
had to scrap the lot
back to sq1
 
Thats correct
The parameter is set before you pass it to whatever is being templated
 
8:38 PM
@BradleyDotNET ok cool, that's a relief
was playing around with the other approach all weekend
thought I would have to use a Unity container
which seems a bit daunting
but I'm planning on implementing the Service Locator pattern in my next project
 
9:08 PM
so correct me if I'm wrong I add the following resource to my View, I don't need to wrap the whole view in the DataTemplate
<Application.Resources>
    <DataTemplate DataType="{x:Type ViewModels:ViewSubjectGradeViewModel}">
        <Views:ViewSubjectGradePage />
    </DataTemplate>
</Application.Resources>
so this is what I've tried, but I'm told ViewSubjectGradePage is not supported, my syntax must be wrong somewhere?
<Page.Resources>
        <DataTemplate DataType="{x:Type ViewModel:ViewSubjectGradeViewModel}">
            <View:ViewSubjectGradePage />
        </DataTemplate>
    </Page.Resources>
 
 
2 hours later…
11:41 PM
This is what I came up with in the end to set data context of my View, Is this a bad/good approach? The VM will only have one View, and the View will only contain a ListView.
 xmlns:vms="using:LC_Points.ViewModel">


    <Page.DataContext>
            <vms:ViewSubjectGradeViewModel />
    </Page.DataContext>
What I'm wondering is, will setting up data context in this manner account for the list that is being passed into the ViewSubjectGradeViewModel? ie, will the parameter in the VM be set before the View is templated?
 
No parameter is passed in that code
so no
 
okay
So that approach won't work as I just tested, will using the DataTemplate work around that?
as in will setting a data template on the View xaml to my VM, prevent the need to specify the parameters that are being passed to that VM?
I tried setting it up earlier, but I'm a little confused as to the implementation.
 
Yes, because you set the "Content" property to a pre-existing instance of the VM, which could have had parameters passed to it
The data template approach doesn't instantiate the VM
 
11:57 PM
ok
I've tried the WPF examples on data templates but Win RT doesn't seem to like
DataType
this is what I tired:
 

« first day (949 days earlier)      last day (3200 days later) »