« first day (767 days earlier)      last day (3382 days later) » 

4:38 AM
hi gm @all
http://stackoverflow.com/questions/616948/how-to-get-treeviewitem-from-hierarchicaldatatemplate-item

tried this answer but the item always returns null where as currentposition works fine
 
 
2 hours later…
6:53 AM
@BradleyDotNET hi! if you have some time, could you please check my question here : stackoverflow.com/questions/27120397/… ? Thanks. :) - it's a windows 8 app question
 
7:44 AM
@BradleyDotNET i've nailed it.. no need to check it again. thanks.
 
 
3 hours later…
11:01 AM
Morns
 
11:14 AM
hi morning
 
hey guys
 
M I doing anything wrong in this

TreeViewItem item = (tv.ItemContainerGenerator.ContainerFromIndex(tv.Items.CurrentPosition)) as TreeViewItem;
TreeViewItem items2 = (actualheader.ItemContainerGenerator.ContainerFromIndex(tvitem.Items.CurrentPosition)) as TreeViewItem;
TreeViewItem items222 = new TreeViewItem();
items222 = (TreeViewItem)(actualheader.ItemContainerGenerator.ContainerFromIndex(tvitem.Items.CurrentPosition));
TreeViewItem items23 = (tvitem.Items.CurrentItem) as TreeViewItem;
 
Did it throw any error ?
 
Morning
the fact that you're using View related code to pull that, yes its wrong
IsSelected TreeView <-- look that up in transcript..
 
Can we get collapsed elements while traversing a visual tree??
on page load??
 
11:18 AM
@Maverik I'm not trying to take it from selection
@AndréSilva no but all the items returns null except items23
 
What are you trying to achieve and why are you not using MVVM ? :X
 
took a ref. from this link
20
Q: How to get TreeViewItem from HierarchicalDataTemplate item?

RazzieI have a TreeView which uses a HierarchicalDataTemplate to bind its data. It looks like this: <TreeView x:Name="mainTreeList" ItemsSource="{Binding MyCollection}> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type local:MyTreeViewItemViewModel}" ItemsSource="{Bi...

1. i'm it to it in the simple method first before to move to MVVM
 
You should blindly dive into MVVM, you'd be amazed
It is not that hard, really.
Why am I trying to convince you to use MVVM ? Because it is amazing how clear and organized your code will get and how easy and correct you'll be able to achieve your goals
 
I Know :)
 
But if you still want to do the wrong way... You should look at the answer below the one that is marked as correct
 
11:24 AM
@AndréSilva i tried that in my case it returns null
2. the problem is all data is coming to me on a single List<String> that's why I'm confused as i'm an occasional developer
 
What are the contents of that List ?
 
Each H1 represents the depth in the tree
 
Really, if you're only trying to add things to a TreeView and return it, you should look at MVVM
You'd need about 20 lines of code to make that work
 
it's not just MVVM
@ArijitMukherjee your code should provide some abstraction level to the reader
 
I know @franssu the problem is the data that i'm getting i dont know the depth of the tree structure
 
11:33 AM
that's your current problem until the next one comes up, you have a more fundamental problem which is failing to implement a clear separation of concerns and abstraction level in your code
 
I'm reading an article on OO vs FP and this image made me laugh
 
11:52 AM
So, I have this VM that, after doing the login, needs to close the View and open another View, while sending a parameter to its VM, is that even possible or should I approach it another way ?
 
you can use an event aggregator
are you learning FP ?
 
Not really, I got to learn a bit about F#, but never had the opportunity to develop with it
I still have tryfsharp.org in my bookmark
Btw, event aggregators are what I should aim for ?
 
Hello mates
 
Hi :)
 
@AndréSilva yes I think you should
you've never used before ?
 
11:57 AM
I am so happy there actually people who work with WPF - one of the best UI Frameworks I know - been using Forms since 1998
 
hi Ronald
 
Hi @franssu
 
This EventAggregator is just a way to A put an info there so B can retrieve it ? And you declare it in the View ?
 
you inject it
:p
in the ViewModel
 
12:01 PM
Hm, it seems really simple, so I'll probably have trouble :D
Let me try it
 
I'm off to lunch
 
event aggregators are awesome
one of the best things I learnt lately
 
Haha it is awesome when you learn something and you can pass that info to other people
Thanks for the guidance ;)
 
 
2 hours later…
2:00 PM
hi everybody
 
hi @FrancescoDS
 
I need a little clarification about IEditableObject interface
I've read some article but I don't understand a thing: is it needed to call methods like BeginEdit on object, or is it automatically called?
 
2:26 PM
and then: I have an ObservableCollection of objects binded to DataGrid. Do I need to implement the interface on object or on collection?
 
I think you have to call the methods
 
the fact is that, when I edit one of the objects I need to edit a value of all other objects in collection, so when I call the cancel method, I need to revert all objects to their starting values
 
that should be automatically done when the edited object's rolled back
 
do you think that automatically other objects are rolled back too?
 
mmmh
each object should send notifications when they change
 
2:41 PM
but maybe I need to call caneledit for each edited object...
 
if objects have dependencies on each other, they should subscribe to those notifications
 
I have not implement a dependency...
 
"when I edit one of the objects I need to edit a value of all other objects"
that's a dependency
 
The property that I need to change is a String index, that stores an index like "1-3" or "3-5"
 
the thing is
YOU shouldn't need to edit the value of all other objects
your design should do that automatically
i.e. it's not the responsability of the caller to know what other objects it has to inform after setting a property of an object
think about INotifyPropertyChanged. When you change a property of a VM you don't manually update all view objects bound to that VM
 
2:48 PM
and that could be done with INPC?How?
 
3:08 PM
yourCollectionOfObject.CollectionChanged += (...) => { foreach (var item in e.AddedItems) item.PropertyChanged += (....) => foreach (var otherItem in yourCollectionOfObject) otherItem.OtherObjectHasChanged(item) }
something like that
but using an event aggregator is better
 
where do I need to do this?
in setter of collection?
 
3:23 PM
yes
 
is it good for me about what we are talking? stackoverflow.com/questions/4587448/collectionchanged-sample
 
not really
you ask for the collection to inform you when it is changed
in the call back of this event, you ask the added items to your collection to inform you when they are changed
in the call back of this other event, you do whatever you need to do to other items when one of them is changed
 
I know that I need to do something different when callback event is raised...but how to implement the callback is right...
 
sorry I don't understand that last part
 
I mean that I know that, in the OnCollectionChanged event I need to do something that updates all other objects in collection
But the Names.CollectionChanged += this.OnCollectionChanged; is right?
 
3:38 PM
is right ?
 
we are not understanding each other maybe :)
 
I think so :/
 
 
1 hour later…
5:04 PM
I have this in my Expander header, can anybody explain why I get this error?
<MultiBinding StringFormat="[{0}] + {1}">
<Binding Path="{Binding FieldValue.Index}"/>
<Binding Path="{Binding FieldValue.Value.DisplayName}"/>
</MultiBinding>
Additional information: A 'Binding' cannot be set on the 'Path' property of type 'Binding'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
 
:)
 
You can't Bind a path
You just want <Binding Path="FieldValue.Index"/>
etc.
 
that's because a binding cannot be set on the 'Path' property of type 'Binding'
 
Bollocks
Thanks
Late in the day
 
 
3 hours later…
8:29 PM
Is it right that NavigationCommands.GotoPage() does not raise navigation events?
Application.Current.Navigating += (sender, args) =>
{
    Debugger.Break();
};
Application.Current.Navigated += (sender, args) =>
{
    Debugger.Break();
};
Application.Current.FragmentNavigation += (sender, args) =>
{
    Debugger.Break();
};
no break
but it navigates
when doing: NavigationCommands.GoToPage.Execute(uri, source);
 
 
1 hour later…
9:40 PM
I'm not sure why it wouldn't raise those events
Though I'm not super familiar with that particular method.
 
no way not easy to raise it manually either, internal ctor for navigatingcanceledeventargs
have you used modernui?
 
Yep
IIRC I use the "Navigate" method for moving between pages
But I don't have any of my Win8 source available at the moment
I could check for you this evening.
 
I have used it a bunch, not a get started q.
Trying to extend it so it fires Application.Current.Navigated et al. when it navigates
the way modern fires events does not fit my needs
 
Ah
That would be a different problem
 
must show an ok/cancel when navigating from settings views if state is not ok
they have this IContent thing but it does not fire when I navigate title links if the setting is in a tab
made a pr to modern with some other stuff a while ago.
that was to make i more wpf
not even a comment :)
spelled linkgroup strange enough for a comment imo
 
10:04 PM
Its worthwhile to note that m:ui is not the same thing as straight up Windows 8 dev
 
It looks nice.
 
It does look nice for sure
I might look at using it in some of my projects
 
@iulian3000 check out the boxes!
I think they are ~done
Even nagged the mighty Reed for some QA :)
@BradleyDotNET not sure I can recommend it though.
 
You don't like using it?
 
10:19 PM
We have had to modify it quite a bit.
would be nice if links etc were controls for binding & styling
now this navigation thing
 
I dont have much time to program lately. I need to find another job, way to time consuming
 
programmer?
 
they have asked me to become a programmer at work now.
 
good for you
im trying to find a job as a programmer
 
10:21 PM
where do you live?
 
spain
 
how is the job market for programmers there?
 
apart from the job, wich is time consuming, the computer at the work doesnt run Visual Studio
not event SharpDevelop
*even
you still use git extensions?
 
in the paint store?
 
yea
 
10:24 PM
@iulian3000 yep
 
give it try to SourceTree
 
is it better?
 
dont know
its new
 
I feel procrastination coming :)
painful with new stuff, I'm old you know
 
jajaja
 
10:27 PM
@BradleyDotNET ping me if you do, I have a NinjectLoader for it that have worked well. Nothing advanced, can push a sample with some copy paste code for you.
gets around the default ctor etc, just use di in views like anywhere else
 
ok, I'll keep that in mind
 
hopefully I will have some event stuff also :)
 
10:49 PM
Is there something nicer than:
    private readonly List<WeakReference> _subscriptions = new List<WeakReference>();
Maybe:
private readonly ConditionalWeakTable<object,object> _subscriptions = new ConditionalWeakTable<object, object>();
and don't use the value
 
Not really sure what youa re asking
 
11:14 PM
object o;
if (!_subscriptions.TryGetValue(source, out o))
{
    var frame = source as ModernFrame;
    if (frame != null)
    {
        frame.FragmentNavigation += OnFragmentNavigation;
        frame.Navigating += OnNavigating;
        frame.Navigated += OnNavigated;
        frame.NavigationFailed += OnNavigationFailed;
    }
    else
    {
        throw new NotImplementedException("message");
    }
    _subscriptions.Add(source, null);
}
^ did that
wanted a list of weak references
using the ConditionalWeakTable without the values (as a list)
prolly nicer with list
no biggie
 
11:33 PM
Well, if you have a key/value map, the table makes sense
I'm sure you could make it with a list
 

« first day (767 days earlier)      last day (3382 days later) »