« first day (1620 days earlier)      last day (2529 days later) » 

6:00 PM
once the gitter integration happens in next few months - we'll get free gitter for our org too
well by free i mean zero effort not as in money :)
though we will get the enterprise version of gitter with all the bells and whistles :D
wonder if github folks have already been upgraded too
 
I'm trying to transfer it to the new group
 
How should we organize samples

50 % (2 votes)Many small repos under subgroup
50 % (2 votes)One repo with folder per sample
0 % (0 votes)One repo with branch per sample.
4 total votes.

Option not in that poll: Repo per Topic with staged branches covering varying complexities (building up on previous branches)
 
can't find ^
 
umm let me see..
 
@Maverik it assumes familiarity with git
 
6:05 PM
true - not a bad thing to deal with :)
 
yeah but info overload applies
 
I'll readily admit its a minor con of this approach
 
but I feel the value it brings to this samples project is much more the ability to see/change branches
done millenium
 
user7442629
How do I handle the enter key being pressed in a textbox?
 
6:07 PM
let me see Johan whats going on with transfer - i think when you did the first transfer - you lost the ownership and thats why its not working
 
Typically an InputBinding
 
32
A: Create Key binding in WPF

AlekseyFor your case best way used MVVM pattern XAML: <Window> <Window.InputBindings> <KeyBinding Command="{Binding SomeCommand}" Key="F5"/> </Window.InputBindings> </Window> ..... Code behind: public partial class MainWindow : Window { public MainWindow() ...

 
user7442629
oh okay thanks
 
55
Q: Capturing the Enter key in a TextBox

Hosea146In my WPF view, I am trying to tie an event to the Enter key as follows: <TextBox Width="240" VerticalAlignment="Center" Margin="2" Text="{Binding SearchCriteria, Mode=OneWayToSource}"> <TextBox.InputBindings> <KeyBinding Key="Enter" Command="{Binding EnterKeyCommand}"/> <KeyBindin...

Man.. beat me to it.
 
nope
, or at least I can't find it
 
6:09 PM
yea i think its because the "organisation" owns it
I'll move it
 
thanks
 
so, how do we name samples?
 
i guess the question about git familiarity needs an answer for that
 
does gitlab have the option to download zip?
 
6:11 PM
yea
among other formats - its got everything you have on github
 
@Alex @LynnCrumbling @milleniumbug @BradleyDotNET - what do you guys think - would asking beginners of WPF to have a basic familiarity with git be a bad thing? we were talking about information overload (which actually I brought up originally) - but I feel getting to know git at a basic level offers a lot more value than the effort required to learn it (especially with a gui tool helping like TortoiseGit)
also sorry for the pings :)
 
It's just another hurdle to need to deal with. It isn't that much to ask, but it is something. If there's a way to request a zip for a specific commit hash, via a web interface, that would make things simpler if the user is having trouble with git.
 
i've never tried that.. lets see
 
I don't think we should require any skill beyond git clone url-of-the-sample
 
6:16 PM
In other words, a way to still leverage git, but take it out of the equation... if need be.
 
No worries on the ping
Maverik, I think learning Git is essential for developers
 
millennium my approach would specifically need git checkout multi-bindings for example
@LynnCrumbling zip per commit is definitely supported
 
What was your thinking on beginners learning Git?
Meaning when they visit this chat room? Or providing a tutorial?
 
for example: gitlab.com/so-wpf/MahApps.Metro.Themes.DarkEmerald/tree/… -> download zip will download at that commit
 
Oh, I see what milleniumbug mentioned
 
6:18 PM
@Maverik Is there a way to get that zip by formulating a url with the right querystring, that we could just point the users to?
 
you mean like the one i just gave you? :)
 
sign in wall
Can we do this without that?
 
ah yea its my personal project - pretend it opens
 
Exactly like the one you just gave :)
 
Oh, so no wall for open stuff
 
6:19 PM
k - gotchya
 
no samples are public
 
Then I'm fully in favor of git.
 
but i was trying to find something with branches
forgot that you can't see it (you can but you need membership into SO-WPF)
 
Yeah, me too
 
I'm not sure I would call learning git essential for developers
although it is moving that way
 
6:19 PM
They should know source control, as a minimum (though Git is more than that)
 
I did professional development for 5 years without touching git
 
(used SVN for VCS)
but if the zip functionality exists that seems fine
 
Too many people in my office don't use any source control. Scary
 
that's what I used before I had to learn Git
 
6:20 PM
@Alex Scary indeed.
 
if you download zip for gitlab.com/so-wpf/samples/BindingSample/repository/… -- this will give you Johans first commit (or should)
 
If a beginner can be shown why Git is good, then their future will be brighter
 
I started with SourceSafe. Ugh.
 
@Alex Maybe they print the code and store it in boxes?
 
6:21 PM
well.. options were limited in 1998.
 
user7442629
For the KeyBinding
 
That... or cvs.
 
user7442629
How do I apply that to a TextBox
 
I'm not quite ready to jump on the "Git is better than everything" option yet :)
 
100 character length filename for a zip file
 
6:22 PM
Yeah, We're still an svn shop.
 
but it is certainly widely-used
 
I smell problems
 
sniff sniff sniff sniff
eewwwwww
 
ahem - did you try that specific commit zip?
 
user7442629
Forget that I figured it out
 
6:23 PM
Rock on. got it.
 
pretty sure its less ugly with a branch name in there
because when i download my CI builds - they only reference master in name
so branch head zip should only reference branch name and folks don't need to know how to open other branches upfront
and this is where a bloggish post will help - nothing too big.. perhaps.. in fact for sure: simple readme ToC will do
and the links can simply be to branch heads - to an end user it's just another link to get another project
 
Should we put a giant "this is not how you are really supposed to use branches" disclaimer in their somewhere?
 
Ok i've gone ahead and made a branch on Johan's project: gitlab.com/so-wpf/samples/BindingSample/repository/…
it still gives you signature in there.. not sure how to change that
haha
 
user7442629
This is really strange
Object reference not set to an instance of the object error, yet debugger shows that the object has a value and so does the property I am trying to access (which is set in the constructor)
 
that disclaimer should probably go in a "pre-requisites" section
curious: do you guys actually care about filenames when you download stuff like source code from internet?
i personally don't even register it
 
6:30 PM
not really
Helps me find stuff occasionally
especially if I'm browsing the source in my browser
@Aleksbgbg VS 2017?
 
well problem with you is - you're not a beginner as such :)
 
user7442629
So long as it isn't vague and is properly grammar-ed then it's fine
 
@JohanLarsson They zip it up and put it on a network share
 
user7442629
@BradleyDotNET VS 2015
 
2017 will tell you what is null
or its supposed to anyways
haven't had an NRE to test with :)
remember that with threading by the time the breakpoint trips etc the value may not be null
 
user7442629
6:32 PM
But it shouldn't be null, it's impossible almost
 
ran into that one more than once :)
 
haha yes we have a tradition of burning NREs on the stake - they've ceased to be :)
 
Are you using log4net or similar?
 
user7442629
No idea what that is
 
he's brand new into c# & xaml
 
6:33 PM
logging library
 
2 months old total :)
 
user7442629
Never heard of a logging library either
 
If you were using such a tool, I'd recommend logging some of your variables out to file
ah
Do you know what a log is? Say from aeronautics or whatever that is for ships?
 
user7442629
Unless it's the conventional log of 'this happened at this time' then no
 
that's exactly it
so we have the same concept as programmers
 
user7442629
6:35 PM
So a logging library logs the execution of your program?
 
people have built libraries to allow programs to log when things happen to disk
sort of
you tell it what and when to log
and it manages splitting into multiple files, getting rid of old ones, etc
log4net is a popular such library for .NET
 
user7442629
I see, so you can trace variables with time, so no funny business of missing the value at the time it changed
 
right, assuming you are logging them :)
 
user7442629
Well that's the problem here then
 
Bug has a nice suggestion: 101-Binding, 102-ValueConverter
 
6:36 PM
O.o where did he say that? :)
i was wondering why is he so quiet!
 
backchannel
 
user7442629
I would totally get a logging library and vs2017 but that would take me at least an hour and no time for that today
 
in some cases, especially threading issues; its a good debugging technique to use your logs
 
Johan yea obviously :D well that implies you've settled on folder / repo per sample based structure and that you've made a plan for things you're covering - because your naming won't leave much room for error
 
sure; just a suggestion for those "impossible" cases :)
Another good practice is to use Tasks instead of threads
 
6:38 PM
@Maverik yeah, that is an issue
 
helps avoid a lot of synchronization problems
 
fine it thats how you want to do it - go ahead.. just remember changing repo names will be detrimental in long run - so be sure a 102 is something that won't end up getting something before it but after 101 in future
 
renumbering would not be much fun
 
user7442629
Wait this code is entirely wrong, still doesn't explain the issue, but it explains the other issues
 
bigger problem: it'll break all the repo links
we can't have that for public facing repo
 
user7442629
6:39 PM
You know in Regedit how you can add keys
 
user7442629
When you add a key, it will display a TextBox for you to create the name
 
user7442629
Same for editing
 
right...
 
user7442629
I want to do that but how do I know which TextBox is being edited
 
6:40 PM
side-comment, that interface hasn't changed since Win95
 
@Maverik github handles renaming of repos
 
user7442629
Well it's good and makes sense
 
Better question, why do you want to know which text box is being edited
because that sounds wrong
 
thats not the issue - you can still rename in gitlab too -- but it'll break everybody else who is linked to your repo from outside - just like it'll break on github >.>
 
user7442629
When you press enter, it saves
 
6:41 PM
ok
 
I'm pretty sure it works, have done it a couple of times
 
user7442629
However I can't do (sender as TextBox).Parent
 
user7442629
Since MVVM
 
works both in browser & git client
 
data binding
 
6:41 PM
sigh.. ok Johan go ahead.. I already said you can go ahead with your approach
 
what millennium said
 
it was just a suggestion
I agree that renumbering is an issue
 
user7442629
Okay I'll see what I can do
 
Either you go off of the simple text bindings
 
i know - and obviously you haven't seen the issue I've seen on github multiple times - the 404 that you run into.. i dont' know how can you avoid that
 
6:42 PM
or bind to different commands, or different command parameters
 
but I'm tired now and my minds blanking out now so I'm gonna leave this discussion for now.. as the major content creator, I think you should have a bigger say in how things work out anyway
 
chances are the content will be null :)
 
whatever else breaks, thats one thing that won't happen
 
massive bikeshed & null content is a pretty common combo
 
sometimes the only way past them is through them
 
6:45 PM
or content goes to null as bikeshed goes to infinity
 
user7442629
@BradleyDotNET just to check, does this seem right? prntscr.com/ep6159
 
not sure, but selectedApplication is obviously what is null
which is not even shown in your locals window
 
user7442629
Well that solves it then turns out I was confusing value with selectedApp
 
user7442629
Rookie mistake
 
yeah, that's just experience
only variable on that line, so the only thing that could be null :)
 
6:56 PM
@Aleksbgbg Don't raise null property changed notifications
you're supposed to raise nameof(SelectedApplication) or whatever the property name you're in
 
user7442629
oh yeah my bad that was old testy code
 
ok do you know what passing null in there does?
 
user7442629
Updates property changed across all properties
 
user7442629
I believe
 
indeed :)
 
user7442629
7:01 PM
Speaking of properties...
If I do new Application() { Name = "newName" }, will the constructor have this property set, or is it set after the constructor?
 
would not have guessed that
lol
It is set post constructor, but before the new call returns
 
though not updates - it says every single property has changed on the object (in wpf's binding context)
 
user7442629
I see
 
user7442629
Talk about ambiguous statements (it was a reply to both)
 
but passing in null is a very context sensitive thing and is best avoided
 
user7442629
7:03 PM
It was done because I hadn't set the other properties' property changed yet, and I wanted to see if the application changing worked
 
user7442629
You guys sure are good at programming
 
application/library source code quality is inversely proportional to the number of null and casts there
 
been doing it a while :)
time for lunch
 
user7442629
@milleniumbug is this relatively true?
 
user7442629
as in, can this be seen in real casaes
 
user7442629
7:05 PM
cases*
 
I'd say it is
 
user7442629
Well by that standard I'm in trouble
 
user7442629
Well my old-ish applications anyway
 
some libraries are also bad in a way that they force you to use casts in your applications
...unfortunately
 
user7442629
Oh right gotta avoid that then
 
user7442629
7:08 PM
Was just working on a library sort of thing
 
user7442629
What is the Enter key called in KeyBindings
 
user7442629
It's not return apparently
 
yea in the modern world we try to stay away from nulls and casts as much as we can
you can usually offer better solution through a fallback static readonly value
like Contact?.FirstName ?? "No Firstname available" would give you a fallback object that you can use (contrived example of course!)
 
user7442629
What's the question mark before the dot
 
user7442629
Curious about that, strange syntax too
 
7:17 PM
C# 6.0 feature
 
user7442629
Nullable value?
 
?. says if the left hand side is null - then result is null
and don't execute the right hand side
 
user7442629
Oh right makes sense
 
?? says if left hand is null - then answer is right handside.. else it's lefthand
 
user7442629
That's really useful gotta use it more
 
7:18 PM
one very important feature of ?. is thread safety
folks that say if(x != null) return x.Length; -- can still throw null reference exception
though why that happens requires indepth reading of multi-threading :) and it's really hard to reproduce this sort of bug
 
guys:
using System;
using System.Globalization;
using System.Windows.Data;

public sealed class BoolToStringConverter : IValueConverter
{
    /// <summary>
    /// Adding a static field to enable referencing via {x:static local:BoolToStringConverter.Default} in xaml
    /// </summary>
    public static readonly BoolToStringConverter Default = new BoolToStringConverter();

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is bool isTrue)
Is ^ a good converter to use?
it is not something that will be very useful in practice
 
is this meant to be contrived?
 
no, it is for the basic sample so should be simple
 
BoolToVisibility would be more useful than this
 
user7442629
7:21 PM
What's the 'value is bool isTrue' part
 
as it is.. bools don't generally need converters
 
user7442629
I don't understand the 'isTrue'
 
maybe I'll change to it
 
that's c# 7
 
@Aleksbgbg a C# 7.0 feature
 
user7442629
7:21 PM
VS 2017?
 
he's declaring variable isTrue of type bool .. inline
 
reason I did not use BooleanToVisibilityConverter is that there is a built in that should be used
 
no C#7 is independent from VS2017 though VS2017 ships with c# 7
 
user7442629
same as '(isTrue = value) is bool'?
 
7:22 PM
well we need to think of a different converter then
 
Date Converter perhaps?
 
user7442629
oh that's great I use that a lot
 
user7442629
Not listening to my friends next time they tell me the new version of VS is not worth it
 
umm though that still involves string..
Johan perhaps something that plays with color brush?
 
7:23 PM
if (value is bool)
{
    var isTrue = (bool)value;
    ...
}
@Aleksbgbg same as ^ but less noise and no way to mix things up
 
nevermind - you go ahead with your example.. we can always do PR on top
 
user7442629
I see thanks
 
Aleksbgbg best to read about different c# versions
 
@Maverik yeah, I wrote that first but did not like it, they are so hard to name
 
c#5 is the common standard though we tend to use c# 6 a lot in here
 
7:25 PM
And I did not want to introduce properties on the converter in the simple sample
 
and slowly c# 7 is getting incorporated
older projects on internet are generally using c# 4
 
aslo not sure about including the static field in the simple sample
maybe I'll delete it for now
 
yea just roll with your simple example and perhaps add in comments that this is only illustrative and generally bools don't need converters
 
I looked at my C# project, and it uses a EncodingToNameConverter and a BoolNegatingConverter
 
WPF's TypeConverters already deal with it
 
7:26 PM
@milleniumbug negated is nice!
 
BoolNegating yes makes the point and is simple
 
It is actually useful
bug wins!
 
i was actually thinking "NotConverter"
but the name sucks (though i think it is accurate!) xD
 
NegatedBoolConverter?
NotConverter is not bad at all
 
it can be confusing
rather have one of the other more descriptive names
 
7:28 PM
I like to have the type in the name as things are so untyped
 
also perhaps add the [ValueConversion(typeof(bool), typeof(string))] on top
 
user7442629
By the way I had a project I made in WPF but WinForms style with a media player, and media players are (to me) really hard to work with in MVVM (particularly syncing a Slider with the TimeSpan's Seconds value of the MediaElement)

Anything you guys know about to do with this? I would love to just do <Slider Value={Binding mediaElement.Position.Seconds}/> but that doesn't work
 
Johan actually did that project
 
@Maverik yeah, not sure though, is it used for anything?
Maybe the designer uses it, or r#?
 
i believe so - can't find the article for it
no it is for wpf
 
7:31 PM
I normally don't add it
 
it's part of System.Data namespace
yea its not mandatory - but i think this is how designer warns when you pass wrong types
 
downside with adding it is that it is slight noise making things look complicated
I'm the worst bikeshedder of us all :)
 
oh i just found this really nice handy article - probably wouldn't have remembered: codeproject.com/articles/15061/piping-value-converters-in-wpf
though not what i was looking for
10
A: The point of ValueConversionAttribute class?

H.B.It is just an annotation. MSDN: When implementing the IValueConverter interface, it is a good practice to decorate the implementation with a ValueConversionAttribute attribute to indicate to development tools the data types involved in the conversion I do not know what the "development too...

 
@Aleksbgbg you can check out this and this
 
yup memory hasn't failed me completely - it is for Designer to help you when passing in wrong types
 
7:35 PM
you decide, add or leave out?
 
cool
 
i'd be biased - i use it out of habit
 
user7442629
Well funnily enough
 
I think I'll remove the static field
 
a shame IValueConverter isn't IValueConverter<TFrom, TTo> though
 
7:36 PM
any help i can lend to designer in helping me when i'm authoring xaml is part of my habit
 
user7442629
I already used that and gave up
 
user7442629
Perhaps I should give it a go once again
 
user7442629
What a small world we live in though
 
the wpf pen source world is pretty small
 
user7442629
By the way the UI for that is absolutely amazing, if I was head at Google and you told me you made that you are instantly the COO dude :D
 
7:38 PM
even smaller when you filter it down to currently relevant stuff!
but I just noticed time.. 8:40pm -- must get goin home.. catch you guys tomorrow
g'night :)
 
user7442629
Are properties changed on the UI thread?
 
user7442629
I know the event is invoked on the UI thread, but is the code inside the set and get events executed on the UI thread
 

« first day (1620 days earlier)      last day (2529 days later) »