« first day (712 days earlier)      last day (3437 days later) » 

1:00 PM
My initial thought was to do versioning by coping the entire data set every time a change was made. It took me about three seconds to realize that was a terrible idea. Just wanted to make sure I didn't miss a better way.
 
Don't take my word for it
The only way I've ever done it is by creating a copy of the table and duplicating rows in there
That's awful
The API guys here have a deleted_date column
So any changes set the deleted_date and make a new row with the new values
 
That's a good idea.
better than my convoluted versioning thing.
 
Hehe
I love recycling other people's work
I should be a manager
 
Hrm, except you still need to tie the new row to the old one somehow... I guess an int? OldId would work.
 
You know, in lieu of knowing anything myself :D
Ah yeah their ORM or whatever has a different convention, or they've done it differently
They have a primary key column and then they have another ID that is the actual ID of that thing
 
1:07 PM
That's kind of gross to me. I was looking at it wrong.
 
So they might have entity_people with entity_person_id as the PK and person_id as the actual ID
It's weird, to say the least
 
That update would be pretty major in my code.
 
Yeah, it would
Adding an old_id column would be much easier
 
Yeah... I'm thinking that's the way to go. I can query that independently and not have to change every other query in my database. Sort of.
 
Maybe. Almost. Not even.
 
1:14 PM
sometimes I hate my company
I am stuck taking my yearly "anti-bribary" training
I have nothing to do with any foreign country or officials or actual money
 
I'll give you .05btc for intellectual property.
 
but our lawyers figured that everyone needs to take the stupid training every year
that's not bribary, that is theft
and I still need to take: anti-money laundering, global anti-trust, privacy, code of contact, speaking up, harassment, 2 security trainings, and about 5 more. every freaking year
and they are designed so each page of the training takes about 2-5 minutes and you can't fast forward
 
1:34 PM
That's the worst
 
ok i think i've almost caught up on Windows 10
 
1:56 PM
Hey @Maverik, Im looking into moving my MainWindow over to a more MMVM approach. One problem I have got is the routed UI commands
 
MM VM ?
Model M ? ViewModel?
 
I think so
mvvm
 
Model Man View Model
 
but what is the second M ?
aaa Man!
 
You always need a man to put things togehter
 
1:58 PM
yes you have my interest now
 
There we go
 
i dont do routed commands :)
 
You just need to know how to motivate him @Asheh
Oh for fucks sake hahahaha
 
he clearly knows!
he put a man in between Model and ViewModel
sandwitching .. i likes!
 
So how do I bind my menu items to their commands in my view model?
 
1:59 PM
I'm betting he's really confused
It's MVVM, btw
 
Yeah
 
Model View ViewModel
 
Silly Typos
 
MMVM is very confusing because it can be a legit pattern!
 
Yes :(
MVVM pattern
I need to bind my menu items to my viewmodel
i currently have lots of these:
ublic static readonly RoutedUICommand OpenProject = new RoutedUICommand
<MenuItem Header="_Save Project" Command="self:CustomCommands.SaveProject"/>
 
2:01 PM
because you're doing it wrong
 
Yep thats why I am asking you
:)
 
have you considered creating an ItemsSource with MenuItemViewModels
 
I have not
 
DateTemplate -> <MenuItem Header="{Binding Header}" Command="{Binding Command}" />
 
Wait, didn't you say you had {Binding Command}, @Asheh
 
2:03 PM
I modified one command to this:
<MenuItem Header="_Open Project" Command="{Binding OpenProject}"/>
 
Weren't we asking because you didn't want to lose the routed UI command?
 
but then you lose the RoutedUICommand stuff
 
that shouldn't work
 
Lol
 
OpenProject is a field - Wpf wont even see it
 
2:03 PM
its an ICommand
 
what is it that you get from RoutedUICommand specifically that you need?
 
public ICommand OpenProject
{
get
{
return new RelayCommand(
(args) =>
{}
)
}}
 
hmm ok
 
There's a button next to the send button, @Asheh "Fixed font". It will format the code across multiple lines
 
then yea that could potentially work, but why would you define manual MenuItems?
 
2:05 PM
Ah thanks
Maverik - because im a noob?
Its a menu didn't expect it to change so I just defined it in the xaml
 
well yea thats one thing, but even then a VM could be static?
it just gives you more room to play and its easier to extend in future
xaml will get ugly pretty quickly
 
Ok, so if i switch menu over to that, how do I use routeduicommands by binding my Menu to an ItemSource?
 
umm you didn't answer the question: what do you need from RoutedUICommand specifically?
 
The double binding
so like Alt+X to Close
The key bindings
 
That's easy!
I KNOW THIS ONE
Wait.....
I know single keys.
<InputBindings> anyway
Sec.
BAM
You just add a modifier
 
2:17 PM
Oh cool
 
But that's in XAML.
 
<Window.InputBindings>
    <Keybinding Keys="X" Modifier="Alt" Command={Binding SomeCommand}/>
</Window.InputBindings>
 
The XAML for it would be....
That ^
The student has become the master
 
say that again (duplicating like master said before)
 
HAHAHAHAHA
I love it
The student (@MosesAprico) has become the master
 
2:19 PM
mmm (wasn't that your respond too? lol)
 
Yeah, it was xD
 
I think Keys isn't a dependency property.. if that is true then you're stuck with xaml startic strings
otherwise all of this can be part of datatemplate and thus of vm
 
it should be : Key, not Keys. Sorry mav
 
Key.. still same comment holds
(i knew something was off about the 's' but it wasn't my primary focus :) - i was looking at it from binding PoV)
 
oh... but it works? Or am I answering a wrong thing?
 
2:23 PM
no i don't know and I'm too lazy to open a new wpfapplication1 just to see if it'll bind
 
Since I am using it that way
I am 100% sure though.
 
you can do Key={Binding Key} ?
 
oh
no
Key is enum
eh
that's not answering your question btw
 
ah
you're forcing me to create an app /sigh
 
Stahp
You can use RoutedCommand in 4.5 and add InputBindings and keys in there
 
2:27 PM
<KeyBinding Key="{Binding Boom}" Command="{Binding AddNewNotation_0Command}"/>

public Key Boom { get; private set; }
 
it works @Maverik
 
<MenuItem InputGestureText="{Binding}"> -- that's what I'll likely go with
 
are you responding to mine? or sean's?
 
to the channel in general
there's no need for InputBinding
so i guess this is really for @Asheh
 
2:31 PM
hello
 
ok then. Moses out.
 
:)
 
back to my project
 
(though your code is correct moses and i'm not saying otherwise)
 
2:32 PM
Ok add that to the menu, Got it. I think
 
yea so you can drive entire thing off VM
 
Yeah :)
 
<Menu ItemsSource={Binding Items} />
 
But where do I define the menu?
 
and this is one of those places where you can very likely use HierarchicalDataTemplate
in your vm
menu items come from Items in binding?
 
2:33 PM
Yea
 
and their appearance from the template
 
So like...

item = new Item();
item.AddItem(new Item()); //
HeirarchicaDataTemplate
 
O.O
eww!
 
So I need to define the binding in the VM too...
?
 
public ObservableCollection<YourMenuItemViewModel> MenuItems {get; private set;}
 
2:34 PM
I dont know what you mean. How else do I define my menu if its not in the XAML?
 
take it easy
 
EACH menu item has its OWN viewmodel?
are you MAD?
Lol
 
so then <Menu ItemsSource="{Binding MenuItems}" />
 
Yeah but what defines the MenuItems
 
how is that different from you adding one per line?
 
2:36 PM
I guess its not that much more work!
 
public class YourMenuItemViewModel
{
    public string Header {get; set;}
    public string Key {get; set;}
    public ICommand Command {get; set;}
}
 
Then inherit from that?
 
of you want sub menus..
why inherit? that's just it?
you bind to it though
from your datatemplate
 
How do I define different commands for different buttons
 
just noticed i set string command.. sorry
 
2:38 PM
In my constructor of my VM, are you saying I do this:
m_Items.Add...
m_items.Add...
For each menu item
specifying Header, Key and Command
 
sigh yea i suppose if you're doing it in your constructor
 
Thats what I mean though, how else?
 
if you find yourself doing things in a Views Constructor - move them to Loaded event at least
 
Where is our Model
Of the menu
 
well I suppose MenuItemViewModel really is Model
 
2:39 PM
You don't need a model if there's no data behind it and it's just for view stuff
 
But what defines the model
 
there's no ViewModel on top - it'll be silly in this case
 
The parent view model
So, your window view model or w/e
 
Yeah so basically im doing what I originally said
 
yea well you guys feel free to label it model or viewmodel :P
 
2:40 PM
item = new Item();
item.AddItem(new Item()); //
HeirarchicaDataTemplate
:D
 
Or all-in-one
With less code
Like...
 
yea ok what you said :P
.AddItem threw me off
 
Sorry
 
.Add() is normal collection add :)
 
ah
get confused using so many languages
 
2:41 PM
.AddItem reeks of winforms and i thought you were going to add controls from code behind like that
i can tell from m_Items :P
 
I was going to construct my m_Items in my viewmodel
and then set ItemsSource etc
 
*m_Items -> m_SubItems.Add(*item);
 
menuItems = new List<MenuItemViewModel>
{
    new MenuItemViewModel
    {
        Header = "Save",
        Key = "S",
        Modifier = "Alt",
        Command = new SomeCommandImplementation(SomeMethodOrLambdaToDoCommand);
    },
    new MenuItemViewModel
    {
        Header = "Open",
        Key = "O",
        Modifier = "Alt",
        Command = new SomeCommandImplementation(SomeMethodOrLambdaToDoCommand);
    }
}
 
View need ViewModel
But ViewModel doesn't always need Model
 
thats quite nice
 
2:43 PM
Go go object initialiser syntax
 
yes thats exactly what i meant - that's why sean gets my cuddles! (and other things too)
 
Allllll the sugar, yeah baby
Perfectly timed messages there, too
I need to do an afternoon's work in an hour
So. I'm gonna head for the day
Have fun guys, talk to you all later!
 
Later
 
yea i was thinkin same - i'm stuck on that saml shiz still
see ya
 
+ thanks!
 
2:45 PM
dunno about him but i can still be ping dragged in here ... just avoid if you guys can :)
 
3:00 PM
pinging maverik is the best thing you can do here!
 
3:26 PM
@Maverik you hear that?
oh yeah, i still gotta get you a sample of my voice for your pings
i'll write a tool to always replace it at startup of browser
hope you like baritone/bass tone whispers
 
it's pong @NETscape
 
4:22 PM
What is the scope of x:Name="" inside of a resource dictionary?
What if you add two of the same dictionary with the same name twice
I.e. the same datatemplates, in two resource files but with the same names?
 
@Asheh the one parsed/loaded last will override the first one IIRC
 
Have any of you guys used adorners much?
 
Ah thanks
 
@JohanLarsson looked into them a bit
why do ya ask?
 
I think I have a use case but have never used them
This is what I want:
I have a button that can be enabled or disabled due to conditions.
If it is disabled I want to add an overlay with an i sign and have the overlay clickable
If the overlay is clicked I want to show a popup
The idea is to create a ~mouse over~ for touch.
No adding adorners in xaml?
guess I can write an attached prop for that
 
4:42 PM
adorners should be attachable in xaml
do you have any adornerdecorator in place?
 
dunno what adornerdecorator is
I just read on msdn that it did not work from xaml, could be dated info
 
I've always seen them done in xaml
so some piece of plumbing is the most likely reason for it not working
 
ok good to know I'll google it then
> Using Extensible Application Markup Language (XAML) to bind an adorner to another element is currently not supported.
sounds good if it is wrong
 
Does it make sense for one view model to contain another?
In MVVM?
 
yes why?
 
4:50 PM
I have my MainWindowViewModel, but then I want to have a separate view for my navigator
 
no problem at all
I have a UserControl, inside of another UserControl, inside of another UserControl
and each UserControl has its own VM
 
Great
 
@JohanLarsson no can't refute msdn and plus now I understand what you meant - Adorner I was referring to was from VisualErrorTemplate
 
I thought it made sense :)
 
@Asheh correctly thought
 
@Maverik attached prop will be nice for it I think, only downside is discoverability
 
heh its your project, i'm sure you'll know when to pull it in ;)
 
Good morning all. Is there any way to set the width of a DataGridColumn in a trigger?
without code behind?
 
5:11 PM
Does public NavigatorViewModel Navigator { get; set; }
Create an instance of the object?
= New
 
@BrandenBoucher should definitely be possible
@Asheh no
 
@BrandenBoucher if you're not using AutoGenerateColumns, then you should be able to
using AutoGenerate, you'll have to apply the trigger via codebehind
 
Is there a shorthand for it maverik?
 
@NETscape, not sure I understand you. If I am not using autogenerated columns then I should be able to set the width in a trigger without using code behind?
@Maverik any idea how?
 
5:29 PM
Asheh: not unless you're in C# 6 (VS 14 CTP 3)
Branden: so are you using autogenerated columns or not?
 
Can we have a collection which observes another collection?
I have my DataRecords, and I have my Navigator. The only thing that Navigator needs to do is be bound to the list of datarecords (like their names) etc.
 
@Maverik no, they are not autogenerated
 
Must find a nicer way than onrender for my adorner :)
 
then just set the width like on any other control? why do you need a trigger?
 
I can just bind my template to the Name. But I need to know when an item was clicked, so maybe Ican bind that to somthing else?
 
5:37 PM
hmm.. not enough information
 
@Maverik I'd actually like to have a ToggleButton expand and collaps a number of columns in my datagrid
 
hmm
gonna have to scribble
checking
 
can you use templatecolumns?
 
@BrandenBoucher since its all view related, why not use a click event and visible/collapsed the columns in code behind?
 
5:41 PM
I know, I know. I'm trying to do it without code behind
I may have found a way
ug. What's really pissing me off is that you can't seem to set a property of one control in the trigger from another control. This seems pointless at first but there absolutely exists use cases for it.
 
@Asheh why not binding to mouse click?
 
@BrandenBoucher i'm trying to sample. it makes sense though, doing this just add dependencies
 
doing this just add dependencies?
 
@Asheh and then record the timestamp (or similar).
 
    <DataGrid>
        <DataGrid.Columns>
            <DataGridTextColumn Header="Test">
                <DataGridTextColumn.HeaderStyle>
                    <Style TargetType="{x:Type DataGridColumnHeader}">
                        <Setter Property="Width" Value="100" />
                    </Style>
                </DataGridTextColumn.HeaderStyle>
            </DataGridTextColumn>
        </DataGrid.Columns>
    </DataGrid>
@BrandenBoucher that'll let you do what you want
its going to be pretty verbose, but at least it lets you do the task based off triggers
 
5:55 PM
will just setting the header width cause the column to resize?
 
should!
 
appears to be working in my blank sample app from visual perspective
(new row's column has same width as header)
 
<ToggleButton Name="Tog">ToggleMe</ToggleButton>
<DataGrid>
    <DataGrid.Columns>
        <DataGridTextColumn Header="Hi there">
            <DataGridTextColumn.HeaderStyle>
                <Style TargetType="{x:Type DataGridColumnHeader}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsChecked, ElementName=Tog}"
                                     Value="True">
                            <Setter Property="Width"
                                    Value="0" />
 

« first day (712 days earlier)      last day (3437 days later) »