« first day (724 days earlier)      last day (3425 days later) » 

4:25 AM
so, weekend ended and the pros are coming back, so I'm gonna throw in a question
 
4:37 AM
It seems that XMLSerializer can't serialize interface. But, quite frankly, my ViewModel have ICommand. There's some solution I read about tagging [NonSerializable] to that. If so, isn't that command will be missing if I load the saved file again? Or not? Since the it's the initialization of the ICommand that is saved in the file? So, the interface doesn't really need to be serialized?
Thanks
 
 
4 hours later…
8:58 AM
hello
may some one know here how to bind contentpresenter content to subelement of component stored in datacontext property by it's key?
i have datacontext instance of such class: class contextclass { public EditorControl Control {get;set;} } where Control stores usercontrol which has subelement marked with a key
and i want this subelement to be shown in contentpresenter of my window
 
9:37 AM
Good day
 
@furier hi fuhrer
 
10:37 AM
Hello. Sorta here. Going to run some reports than commute back home.
 
10:53 AM
@Markus I know this is old and I somehow missed answering this: That is a Hostname \ InsanceName uri specically valid in MSSQL connection strings
Morning other peeps.. catching up still..
 
Kay thanks
morning
 
@MosesAprico interfaces are abstract - something that has no implementation.. thus you cannot save them.. you need to save the underlying type
the concrete type.. Though in ICommands case you don't need to save it anyway. A Command doesn't have a state that needs restoring normally - just create a new instance and pass this if you have to
 
@Maverik Got it about the ICommand, what if I have a Model (interface) in my ViewModelBase (abstract class)? I can't save the Model then?
        private Model _model;

        public Model Model
        {
            get { return _model; }
            protected set { _model = value; NotifyPropertyChanged("Model"); }
        }
public ViewModelBase(Model model)
{
        Model = model;
}
It's impossible to have a new Model each time a file loaded afterall
since there's the data lies
 
Ey maverik, my visual studio is playing me a trick i think...
Can I define margins and and paddings both ways ? "0 5 0 5" and "0,5,0,5" ?
 
@furier that rhymes..
 
11:17 AM
@furier I'm not sure but i think yes. I always use the comma version
 
yeah cus visual studio is not giving me feedback
:S
but thnxs
 
just have insane margin and find out
100,0
 
11:47 AM
Morns
 
Morning
 
Today I won't produce any code. I forgot my headphones :(
 
12:18 PM
Mav or anyone
[NonSerialized()]
private Model _model;
the serializer seems still serialize it
how come?
 
12:40 PM
using the wrong attibute
I'm guessing you're using XmlSerializer?
if you are, use [XmlIgnore]
 
1:04 PM
yes
 
Anybody knew of this little gem: GitIgnore Generator
(I suspect its a front to github.com/github/gitignore)
Oh and source if you want to upvote / credit:
590
Q: .gitignore for Visual Studio Projects and Solutions

Martin SuWhich files should I include in .gitignore when using Git in conjunction with Visual Studio Solutions (.sln) and Projects? Community Wiki: #OS junk files [Tt]humbs.db *.DS_Store #Visual Studio files *.[Oo]bj *.user *.aps *.pch *.vspscc *.vssscc *_i.c *_p.c *.ncb *.suo *.tlb *.tlh *.bak *.[Cc]a...

 
@Maverik but if use [XMLIgnore] then I can't save the Model then? Because it's in ViewModelBase, which different VM's parent
I still can't get it sorry
I've explained it completely with code here :
0
Q: Dealing with "need-to-be-saved interface" in a serialization (XMLSerialize)

Moses ApricoOkay so, I've read several article and writing across the internet about "Serializing Interface" issue. From what I've read, even though there's several workaround to make interface to be serializable, it seems that interface shouldn't be serialized, because it's not the real object. So, okay, ...

 
implement ISerializable if you cant' make it work with attribute
 
1:56 PM
posted on October 13, 2014 by ericlippert

I’ve done many articles over the years on different ways to manipulate sets and sequences in C#: The Cartesian product is when you have a sequence of sequences, say { { 1, 2 }, { 10, 11, 12} } and … Continue reading →

 
2:18 PM
meh
 
2:41 PM
Good morning all (For all the people who it is morning for I guess)
Hello to the rest as well
 
mornin
 
I do have a question. How do I bind to a property of a sibling control. Say I have a checkbox and a textbox in a stack panel, and I want to disable the textbox based on the IsChecked value of the checkbox? The catch is I don't think I can use the Name property on the checkbox.
 
why not?
 
@BrandenBoucher you can meet them up inside the parent VM
 
I probably could, but wouldn't that mean putting visual elements in the VM (or model in my case)
 
2:52 PM
@BrandenBoucher why can't you use Name?
 
@BrandenBoucher no. it's your control's VM, which you Bind from
@NETscape what do you think of the accepted answer in this question?
42
Q: XML serialization of interface property

EladI would like to XML serialize an object that has (among other) a property of type IModelObject (which is an interface). public class Example { public IModelObject Model { get; set; } } When I try to serialize an object of this class, I receive the following error: "Cannot serialize membe...

 
@NETscape I'm just not sure I can. Imagine if the StackPanel that holds the checkbox and textbox is itself contained in an ItemsControl and is loaded dynamically with multiple instances of the StackPanel
I'm actually building a little test to see if it will work anyways
@MosesAprico I mean, I'd have to put a bool property in my Model because there would be multiple, dynamically loaded instances of that StackPanel based off of a collection of my Model.
 
@Branden why not use a view model?
 
yes, like what I talked about earlier right?
 
@MosesAprico looks like it is the only way to work around the issue, so i guess i agree with it
 
3:05 PM
@NETscape hmm.. then look at Despartar's answer, which one do you prefer?
 
@NETscape I do have a VM but maybe I am taking the paradigm to litterally?
 
@MosesAprico Moses you need to learn to make your own decisions
if you don't have enough knowledge to make that decision, then you need to fix that
if something goes wrong, its going to be your rear on the line so it has to be your decision
So please stop asking the members for their preferences on your project decisions.
Brandon, show us the Xaml
 
i prefer neither because i haven't ran into the issues ;)
@BrandenBoucher aren't you using an itemscontrol with an itemtemplate?
 
even if you have, it has to be authors decision otherwise by giving advice, you're becoming a party to that decision
 
@Maverik actually, I'm not going to accept blatantly anything NET's answer, I just wanna know his way of thinking.. since I've read through this in several site and still haven't quite understand this..
 
3:09 PM
if you're not going to accept his answer blindly, then its a waste of his time
along with the rest of getting involved in this conversation
 
@NETscape Yes, I am.
 
Bottom line is: I'm trying to get you to make your own choices
you're becoming a textbook case of help vampirism
and it's not going to bode well for you
 
@Maverik yes I know. It's the thinking behind his / your answer that I wanna know for thinking / googling reference.
sorry for the misunderstanding.
 
no there's no misunderstanding
Specifically you're falling in : Are they obviously just waiting for some poor, well-intentioned person to do all their thinking for them?
 
@BrandenBoucher <CheckBox x:Name="cb" /><TextBox IsEnabled="{Binding ElementName=cb, Path=IsChecked}" /> should work?
 
3:13 PM
There's a much better resource for help vampire, but i can't dig it out so referring to extraction from meta
 
@NETscape OK. I'm going to test that now. Thanks!
 
@Maverik okay then, I'll get back. Thanks for warning
 
it might just be Checked instead of IsChecked, might have to use a converter, idk. i'm just going from the top of my head.
 
There's no need to get offended by this. Its a pattern a lot of people fall into but somebody has to point it out to get it to stop
We're here to help, but we need to draw a line somewhere. This pattern is harmful both for asker and for the community in general
 
(Moses, Mav is right, I was in your shoes about 2 years ago and Mav laid into me at one point. from then on is when i started actually learning)
 
3:17 PM
I don't feel offended by the way.. (sorry if my word reflect that I was offended, I really don't, english is not my primary so there might be miswording issue)
 
@NETscape It does work as I wanted. To be honest, I thought that if I did a binding on the ElementName, every instance of the textbox would have its enabled state set when any of the checkboxes were checked or unchecked.
 
@MosesAprico oh ok, I just thought may be I offended and I should clarify that I'm trying to help you in long term.
 
@NETscape there's not even 1 year since I started this project hahaha...
 
i know your intention, and its easier to listen to what other people have to say vs. having to actually learn about something, but trust me; you will benefit gaining a full understanding by yourself because you'll become an expert on the matter. You'll be able to answer business as to why you did things the way you did, and you'll be able to determine why things are broken if they break.
 
@Maverik understood
 
3:19 PM
you know, that kinda stuff... and it'll feel good when you are able to act as an expert on the code you're using
 
got it guys. thanks.
 
@BrandenBoucher it will be scoped properly. each item in the itemscontrol only knows about itself :) similar to each item has its own datacontext.
 
to avoid this problem in future: If your question has a specific answer, you can freely ask it. If it is a subjective question, you're better off not asking that and try to build your own understanding so you can make a choice
good luck with your serialization. Its not really a hard problem and you'll crack it soon enough :)
 
@NETscape gotcha. That makes sence
 
hey Johan
 
3:21 PM
@Maverik got it. thanks! :D
 
so i was trying to help a friend set up a router last week
NETGEAR to be specific
and they have an online chat feature
and i was helping my friend over a chat program
and eventually the worker at netgear asked for the registration information that the product was registered under
and i said, no you don't need that, you know the make and model of the router, just help me with the question i have
and they said, no, for security reasons, you need to provide the registration information so we can further assist you
I didn't want to ask my friend for the information because it would have been a hassle. i just kept saying you don't need my information, just help me. he said it is alright if you just give us your information so we can help? (name phone e-mail zip address state etc).
and I said no, because this chat feature isn't even over a secure connection, and you're going to ask me for personal information and decline helping me until i give you that information? no, you're not getting my information. thanks. bye.
in short, everyone send some hatemail to netgear for me :)
this all stems from reading this article. I don't understand why everyone needs to collect every piece of information in order to provide service to users. Sure, a lot of it is good intention in a way, but seriously...
/rantover
@Maverik you going to abandon your slack forever? :p
 
nah my slack is running on mobile
i'm just not checking notifications constantly :P
 
3:46 PM
@Maverik I can tell :)
 
 
2 hours later…
6:00 PM
Yo @FLCL
 
 
1 hour later…
7:17 PM
Good afternoon people
 
ooyahi
 
 
2 hours later…
8:55 PM
@ReedCopsey how do you go about different visuals for different levels of access in your application? Lets say you show a grid in your application in Ultimate Edition, but in Standard, that grid shouldn't be shown.
 
I typically use completely different views
I've approached it a few different ways over the year - in my app, it's not really an issue, because entire "tools" turn on or off
and I purposefully don't hide UI - I want them to see what they're not paying for :)
 
mhmmm
if i want to purposefully hide them... how should i go about doing that do you think?
if you turn a tool off, but show the UI, how do you prevent them from using the UI
 
I had a question about some WPF stuff. I have an Administration section where you can add look ups and other data, as well as edit existing. The fields are based on entities in the database.
 
ok
 
my quuestion has two parts.. 1) I have a datagrid for the records for each entity, an Add button, and an Edit button. What is the best way to keep track, either in xaml or the viewmodel, the current selected item. It needs to be dynamic so that when I hit add ti knows its a new object. I just wanted to know basically if the MVVM Light framework, C#, or WPF has something to help make this process easy so that I don't always have to 'new' up new objects.
Currently, I bind a 'new' object that is instantiated in the constructor when the VM is loaded.
and I have to do some logic, depending on which button is clicked, to wipe it and new it up again, save it, etc...
and 2) Is there a way to dynamically generate the fields that represent the entities so that I don't always have to go in to each layout and add another text field, datepicker, etc.. if I have anew field to the database/model declaration.
 
9:05 PM
in XAML, is your DataGrid <DataGrid ItemsSource="{Binding EntityCollection}" ... />?
where EntityCollection is a ObservableCollection<Entity>, or a collection of some sort.
 
um
yes
(they client doesnt want inline editing in the datagrid)
 
then in that same class (your view model), make a public object SelectedItem
 
we double click a row, or click a button, and it brings up an Overlay
 
and do <DataGrid ItemsSource="{Binding EntityCollection}" SelectedItem="{Binding SelectedItem}" ... />
 
okay I do that so far
but I have to 'new' SelectedItem up in the constructor or it never binds
 
9:11 PM
@user1296981 I think the only way to do this is if you autogeneratecolumns=true... and i don't know if it will generate the correct column everytime depending on the field type you add...
 
It's not the datagrid columns that I want to auto generate
 
@user1296981 sounds like you're doing something wrong then. What does your SelectedItem property look like in your view model.
 
its the editing fields in the overlay
if that is at all possible
 
it must be possible since autogeneratecolumns effectively does that (chooses the correct datagrid column type), but I can't imagine it being an easy feat.
 
that's what I figured
 
9:15 PM
@ReedCopsey might know more
 
I just knew MVC 5 had an awesome auto CRUD/form generate fo rentities
 
the SelectedItem though, that should work no problem assuming your property is written correctly
 
but that's all HTML based
i just do a typical MVVMINPC
tab it out
make it the proper datatype
and set it equal to null
public const string NamePropertyName = "Name";
private string _name = nulll;
public string Name
{
get
{
return _name;
}

set
{
if (_name == value)
{
return;
}

RaisePropertyChanging(NamePropertyName);
_name = value;
RaisePropertyChanged(NamePropertyName);
}
}
 
(the dynamic field binding/type is also found in PropertyGrid, so you could look into that implementation to try and work something out)
ehh, uhhh.
you need to do
public object SelectedItem
{
    get { return _selectedItem; }
    set {
       if ( value != _selectedItem )
       {
           _selectedItem = value;
           RaisePropertyChanged(SelectedItem);
       }
   }
}
of course when the datagrid is first created/shown/bound, SelectedItem will probably be null until you click on an item.
 
not equal?
 
9:19 PM
you only set a new selecteditem if it isn't equal to the previous selected item, typically.
 
haha yeah thats true
 
everytime you add a new row/entity, you need to use new anyways, otherwise all items will reference the same object
 
that actually explains a lot
i just totally overlooked that little part there
 
its essentially the same code as if ( _name == value ) return;
but you have to bind DataGrid.SelectedItem to a public object SelectedItem {...}
it has to be object... not string, not int, not MyType.
 
@NETscape Disable it ;) My most common means of handling this is to just stick a converter on enabled (or visible in your case) to hide things
 
9:27 PM
okay thanks NET
appreciate the insight
 
10:08 PM
Anyone know of a good method to handle insert records that have a sort order
so I can shift current values in the sort order and maintain some sense of order?
like if i have sort order 1, 2, 3
and i insert one with 2 i want to change the existing 2, 3 to 3, 4 and plop the new one in
 
can't you just sort your bound observable collection?
you may have to fire off a IPNC to get the ui to refresh
 
unfortunately
specifications dictate a stupid SortOrder column in the database =/
SO I have to write some ridiculous swap and sort method when adding or moving records in my queue
 
10:33 PM
Collection = new ObservableCollection(Collection.OrderBy(c => c.RidiculousSortOrderColumn));
(after an insert)
 
haha yeah that aprt i got
its the part before
the logic to actually shift everything in the insert statements
specifically, this is not saving like it does in other parts of code
this is inside a USING statement on my datacontext:
if (newDriverQueue.SortOrder <= item.SortOrder)
{
item.SortOrder++;
}
else if (newDriverQueue.SortOrder > item.SortOrder)
{
item.SortOrder--;
}
item.SortOrder = 100;
_db.SaveChanges();
that item.SortOrder = 100; line
is jsut a test to see if its saving
and it isn't
 
clear the table, sort the list, re-insert the records. ;) easy, peasy, lemon-squeezey
although not very efficient, but if you have to update the sort-order in most of the rows anyway
 
oh that sounds disgusting
why doesnt that _db.SaveChanges() work
?
withina foreach loop
foreach (var item in driverQueueList)
{
if (newDriverQueue.SortOrder <= item.SortOrder)
{
item.SortOrder++;
}
else if (newDriverQueue.SortOrder > item.SortOrder)
{
item.SortOrder--;
}
_db.SaveChanges();
}
doesnt update it as i go
=/
 
I would think that it would work, but I am an ef novice
 
hah yeah same
 
user2509848
11:02 PM
@user1296981 Couldn't you do ObservableCollection.Insert(index, item)?
 
user2509848
Just figure out where you want it, then insert it.
 

« first day (724 days earlier)      last day (3425 days later) »