« first day (866 days earlier)      last day (3283 days later) » 
00:00 - 21:0021:00 - 00:00

21:00
The informations missing I just explained above.
@Riva was that supposed to be vertical alignment and horizontal alignment?
Yep. Sorry for shortening it.
it'll get the same available size no matter what alignment is specified -its up to you to align within the arrange call
you can implement alignment however you choose
In theory, you should be returning the same thing regardless of how you are positioned/aligned
"The ultimate goal of the measure pass is for the child to determine its DesiredSize, which occurs during the MeasureCore call. The DesiredSize value is stored by Measure for use during the content arrange pass.
The arrange pass begins with a call to the Arrange method. During the arrange pass, the parent Panel element generates a rectangle that represents the bounds of the child. This value is passed to the ArrangeCore method for processing.
The ArrangeCore method evaluates the DesiredSize of the child and evaluates any additional margins that may affect the rendered size of the element. A
from that page ;)
21:02
The framework positions you
you position your children
My FrameworkElement doesnt have a child though, so it's a bit difficult for me to apply the example there to my case.
My .. lets call it MyControl ? .. should be drawing a Bitmap. So I should consider that Bitmap(Source) a child I guess (?)
what is your frameworkelement doing?
ie: why are you making a custom one in the first place?
Yeah, why are you even messing with measure/arrange if you aren't a panel?
I need the bitmap displayed DPI-disregarding so to say.
the existing Image component counts in both system (OS) DPI and even DPI set in some image files metadata. Result is unpredictable and a mess :)
I failed to find an existing component that would behave like Image, but render the bitmap pixel-precise in case Stretch is set to none or more importantly when the FElement has enough space in layout that it doesnt need to be resized in any way.
(ie. Scaled down)
just strip out the DPI information (set to 96) in the image first
and you can eliminate scaling from the image
much easier than trying to make your own bitmap control
21:10
Afaik the image then will be considered having default DPI (96?) and if its not the same as system DPI it will still be stretched.
I think I tested this and if I read the results right thats what it does. So just stripping DPI info from BitmapImage doesnt really solve it.
yeah - you could just steal this code, btw blogs.msdn.com/b/dwayneneed/archive/2007/10/05/…
My designer handed me another ListBox control that he's created. This time, though, instead of a Style (with a nested ControlTemplate), there's just the ControlTemplate. I've been using ListBox's ItemContainerStyle with a style... but that doesn't support a ControlTemplate.
that is effectively what you're doing
@ReedCopsey not sure what you mean ?
that page I linked, at the bottom, there's a link to a zip file
21:13
Should I (1) be using a different attribute, (2) make sure that the ControlTemplate is wrapped in a Style, or (3) doing something entirely different?
that's basically exactly what you're describing
(it's a Bitmap class that's a drop in replacement for Image which ignores all scaling)
@ReedCopsey But I dont want to ignore scaling by Layout system. I 'only' need to ignore scaling by DPI (system DPI setting and particular image DPI data).
It's entirely unclear to me why I've been dealing with Styles this whole time, and now suddenly I've got an unnested ControlTemplate.
I think control templates are always part of styles
@LynnCrumbling probably just need to wrap it in a style
and/or just set it as the control template for the control you want, if it's only used once
21:17
@BradleyDotNET I suspect this is blend-generated code.
@LynnCrumbling If it's only used in one place, you can just set it as the control's Template directly: msdn.microsoft.com/en-us/library/…
(without styling the control via a style)
@ReedCopsey I already though of just taking that component and wrap it in ViewBox. Not sure if it would work. Anyway that's kind of a hack.
@ReedCopsey It's actually for the items in the ListBox control. At first, I thought I should be using ItemTemplate, but that doesn't take a ControlTemplate.. it takes a DataTemplate...
And that got me thinking... should this be a DataTemplate?
(or - is ItemTemplate just the wrong thing to be using.)
Is it supposed to be the visual representation for the items?
@BradleyDotNET Exactly.
21:20
Then it should just be an item template
no reason I can think of to use a control template there
(The binding item .. is an array.)
@BradleyDotNET Ok. That makes plenty of sense. Is it as simple as changing the "ControlTemplate" tag into an "ItemTemplate" ?
It would be DataTemplate as you said before
and it could be
Oh, right. Thanks :)
Well, it does indeed seem that easy.
Seems like this is really a Q\A room most of the time :)
Are there any real >chat< chatrooms on SO ?
well, we often chat in here, too :)
and in some of the others
21:32
well some of us are working. so we usually keep it related, but we do go off topic sometimes... only if its lunch time ;)
Still in the office ?
Not sure of the timezones but here its past 10PM :)
Otherwise I wount be able to work on my hobby projects :)
@Riva C# gets off on tangents more if that's what you are interested in
@BradleyDotNET All right. For some reason I have WPF in favs so I think always end up here. :)
I like it because we do usually stay on-topic :)
we have someone in like every timezone
21:36
@ReedCopsey Im almost scared to talk anything offtopic in here. Seeing questions answers bouncing there and back :)
@Riva The tavern is pretty chatty, but that's SE, not SO.
definitely for C# for the most part haha. we are here to help. if i need a break i go to C#
hey @Hosch250 hows it going
@LynnCrumbling Nope. Im scared to leave SO. :)
user2509848
Hi, just fine.
Hello
user2509848
21:38
How's it going?
@Riva And it's still got a "topic" (all chatrooms do). It's just that the "topic" is the entire stack exchange network, not just SO.
i see that SO just changed their layout for user profiles
good good. installing stylecop
@NETscape Haven't been there in ages.
@Riva We aren't going to hurt you or anything ;)
user2509848
Have you ever worked with ListBoxes?
21:39
lol
@NETscape Wait until you see what's coming. Hit the Meta for SE, and go to your profile.
All the time
@Hosch250 its "just" a ItemsControl, so yeah
user2509848
I have a ListBox that is bound to an ObservableCollection.
ok, pretty standard
21:40
@BradleyDotNET Why would you do that ? :)
@Hosch250 I do all the time :\
user2509848
I am working in a Windows Store app for Windows 8.1, so I don't have a treeview.
ok, half of the time :)
alright, no tree view
nothing i hate more than a progress bar hitting 60% in 3 seconds then spinning for 5 minutes
no kidding
21:41
stylecop i'm looking at you
@NETscape StyleCop the VS .. component .. tool .. thing ?
yeah
sick of inconsistent styling
of your code ?
yeah
I wish I had that kind of problems (only) ;)
21:50
@Hosch250 Did you have a question?
I mostly work in XAML so not much code styling possibilities for me I guess.
i wish all i did was XAML
maybe
not really
ha ! :)
Well Im a GUI designer so I don't mind.
@NETscape I never had issues with stylecop
I like getting to work all sides of a project
21:53
It's when I try at some grownups work, like that damn Layout passes, when my trouble start :)
@JohanLarsson every machine i've installed it on, it ends up spinning for awhile during installation
oh installation, don't remember that
is style cop say.... like the code formatters in eclipse, where it auto formats your code on save, or is it an analysis tool you run to sorta 'one at at time' coding sops violations
user2509848
OK, sorry about that, my internet went down.
user2509848
@BradleyDotNET Yes, but I was disconnected :(
21:58
no problem
user2509848
Anyway, when an item in the ListBox is clicked, I sometimes insert a set of MenuItems (a custom type), into the ListBox, so it displays like this:
user2509848
user2509848
See how I have what appear to be a menu and a bunch of menu items?
user2509848
My problem is when I try to navigate the layout with the keyboard buttons.
ok...
That should probably be templated
but continue
user2509848
22:02
Because of the insert, after the menu opens, it sometimes doesn't always go to the next item:
@JohanLarsson can't i have the same settings for all projects in my solution?
user2509848
user2509848
Notice how Recording Group is kind of boxed, but it isn't the next one in the list.
@NETscape how do you mean stylecop?
user2509848
I tried to fix it by writing KeyDown handlers to handle the up/down buttons, but that didn't work.
22:04
If you say so :)
my vision is terrible though
@NETscape put the stylecop settings in the sln folder
user2509848
If you click the image, it will zoom in.
done correctly, you shouldn't need that
user2509848
OK.
got it meow
user2509848
22:04
So, you said I should research templating?
user2509848
Isn't that so I could display an image or something next to each item?
Its how you handle display of each item of a bound data source
user2509848
OK, this is how I am currently doing it:
user2509848
<ListBox Name="Items" Grid.Column="0" Grid.RowSpan="2" ItemsSource="{Binding ItemList}" DisplayMemberPath="Title" SelectionChanged="OnSelectionChanged"
         Tapped="Items_Tapped" Margin="-2,-2,0,-2" KeyDown="ItemsKeyDown" Style="{Binding Theme, Converter={StaticResource LBStylePick}}"
         ItemContainerStyle="{Binding Theme, Converter={StaticResource LBIStylePick}}" Padding="0,10" SelectedItem="{Binding CurrentItem, Mode=TwoWay}" />
user2509848
Down to the basics:
22:07
so you click Insert Tab, then hit the Down Arrow and it boxes Recording Group?
user2509848
    <ListBox ItemsSource="{Binding ItemList}" DisplayMemberPath="Title"  />
So when you insert, it modifies "ItemsList"?
user2509848
Yes.
ok, then you should be ok then
user2509848
The insert is done in C# in my VM.
user2509848
22:07
@NETscape No.
@JohanLarsson nothing is getting underlined :(
doesn't it usually
user2509848
When I start at the top and just use the cursor to navigate, it doesn't work.
user2509848
The peculiar part is that it doesn't do this in the first drop-down.
user2509848
It only does it in the drop-downs after the first one.
@NETscape no you need to run cop explicitly. A very good thing imo. There is an R# integration that underlines things. Very annoying imo.
user2509848
22:09
I've been publishing with it like this for a while now, but it is really bugging me, and I thought I'd ask if you guys have seen anything similar in the past.
I tried to write a unit test that should run Stylecop. Did not finish it.
user2509848
I don't have any clue of why it is happening.
Did you try to check where your KeyboardFocus is before the new items insert and where it ends up after ?
okay, that question took some work to answer :S
user2509848
My keyboard focus is on the ListBox.
22:13
@ReedCopsey link?
user2509848
Because, I just was using the keyboard to navigate within it.
6
A: StackOverflow Doing Boxing C#

Reed Copsey Why , if there is not significant overload of IL's stack for second example, it crashes "faster" than the first one? Note that number of IL instructions does not accurately represent the amount of work or memory that will be used. A single instruction can be very low impact, or very high im...

Should be on a specific ListBox item (its ItemContainer) if you are using cursor keys to navigate the ListBox items.
user2509848
Well, it is specifically on the ListBox, as far as I know.
@JohanLarsson I give the OP credit - was well written for a first question, though people are (weirdly) voting to close it
user2509848
22:15
It might be on a ListBoxItem.
On SO all things must be closed always. Annoying imo.
It's possible the Listbox looses KeyboardFocus when you update its Items collection.
Should be very hard to close something with ten upvotes.
agreed
does show how nice generics are, thoguh
I love generics
they make me happy
like the expando object, when I find a real use for it that is
:P
user2509848
22:17
OK, I just realized something.
user2509848
Well, I had already realized it, but forgot.
@MarkW Are they crunchy ?
generics or the expando object
lol
user2509848
What I think is happening, is it sets currently active ListBoxItem based on the SelectedIndex.
expando objects are Java right ? Java not crunchy :)
22:18
expando is .net
C# generics are nice for embarrassing generic stuff.
user2509848
So, I remove a bunch of items and insert a bunch more, but the focused item has the same SelectedIndex.
and when I first read about them I thought they were awesome, and figured I would use them all the time.... turns out ive never had a valid use case for them that ive been able to recognize
@MarkW then its both. Maybe just coincidence in names.
but like bigfoot..... I believe one exists!
and I will find it eventually
user2509848
22:20
So, when I press the down button again, it just increases the former SelectedIndex value, not the current SelectedIndex value.
@MarkW They do exist, they are just rare
:D I knew I liked you bradley
its far more common to use generics than create a class that is generic
user2509848
So, what is happening is something like Items.SelectedIndex = Items.SelectedIndexBeforeMenuChange
I had one where I was sending 20 types of events to a server
user2509848
22:21
Instead of Items.SelectedIndex = Items.SelectedIndex + 1
generics were a huge benefit there
@MarkW I haven't used ExpandoObject, but I've written my own dynamic objects
though, to be fair, the only reason I did it was to support data binding, and if I was doing it over, I'd approach it differently ;)
well you dont count cuz you tend to have written the book, or multiple books, or at the very least a novel length blog post about [insert any .NET related thing here]
@Hosch250 You dont visualize which item is selected in any way ?
im just a mere mortal
22:22
lol
user2509848
@Riva Huh?
nice thing about ExpandoObject and dynamic is that WPF data binds into it
that's the most useful feature ;)
user2509848
I can see which item is selected - it has a purple highlight.
@Hosch250 Nothing. I was just thinking how I would debug it. :) But Im mainly an artist so I have to SEE everything.
user2509848
The trouble is, when menu A is closed (items are deleted) and menu B is opened (items are added), it doesn't update the index of the ListBoxItem with keyboard focus.
user2509848
22:24
So, I need to manually change the item with keyboard focus, I think.
strange star
I removed them ;)
it's too strange for me
Reed Copsey doesnt laugh
yeah, better not let Mav see stuff like that.
22:25
what star ?
@Riva someone starred reeds lol comment above
it is gone, probably a misclick
I removed it ;)
@MarkW So .. a screenshot or it didnt happen ? :)
damm too late :)
I wrote a hairy hack for the xml ~lib~ it handles roundtrip of IEnumerable<Intercafe> now
not very robust, the opposite in fact
22:28
im out guys, cya later
user2509848
See you.
@Hosch250 ..to 1st item in the newly added menu .. ?
Bye
user2509848
@Riva To Items.SelectedIndex.
Reed d you know if there are any plans on making wpf open source?
Should have been so long ago imo.
user2509848
That value updates, just not the value of the keyboard focus.
user2509848
22:29
@JohanLarsson Isn't it part of .NET?
user2509848
.NET is open source.
but the development
.NET is open source ?
user2509848
Yes, .NET is open source.
user2509848
22:31
I believe anyone can submit a merge request through Github, but Microsoft reviews everything before it is merged.
I know EntityFramework was made a public thing, but didnt hear about whole .Net
user2509848
At least, .NET Core is open source: blogs.msdn.com/b/dotnet/archive/2014/11/12/…
.. going to GitHub to check ..
user2509848
I thought I read the whole .NET was.
22:32
ah, so its a new thing.
user2509848
I believe this has what I need:
user2509848
17
Q: How do you programmatically set focus to the SelectedItem in a WPF ListBox that already has focus?

MarqueIVWe want to set the SelectedItem of a ListBox programmatically and want that item to then have focus so the arrow keys work relative to that selected item. Seems simple enough. The problem however is if the ListBox already has keyboard focus when setting SelectedItem programmatically, while it d...

user2509848
Exactly my issue.
Does that count as my 1st answered question on SO ? ;)
user2509848
You were my rubberduck.
22:37
Thats a good thing ?
Yep
Rubber duck debugging is an informal term used in software engineering for a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line-by-line, to the duck. Many other terms exist for this technique, often involving different inanimate objects. Many programmers have had the experience of explaining a programming problem to someone else, possibly even to someone who knows nothing about programming, and then hitting upon the solution in the...
haha. Yeah. That does work for me a lot of times.
I have my brother for that :)
Can't call him a rubberduck tho, else there be a fight :)
user2509848
Theoretically, this should work: IsSynchronizedWithCurrentItem="True"
user2509848
However, it gives me the error that the value True is unsupported.
user2509848
I can set False, but not True :(
22:41
Because you are already binding selected item ?
user2509848
Something.
user2509848
Anyway, I'm going to try the top answer.
user2509848
That isn't working either!
user2509848
It is telling me that it has been depreciated and won't work after Windows 8.1, and suggests something that doesn't exist.
user2509848
22:47
And, it isn't working as it is either :(
> I often prefer using the current type instead of the runtime type.
@Reed what does ^ mean?
user2509848
23:03
> ((ListBoxItem)Items.ItemContainerGenerator.ContainerFromIndex(Items.SelectedInd‌​ex)).Focus(Windows.UI.Xaml.FocusState.Keyboard);
user2509848
Doesn't work. :(
user2509848
Anyway, I know what is happening, so I'll work on it as I have time.
user2509848
Thanks for the help.
23:51
@JohanLarsson Where's that from?
probably meant that they preferred using the compile time known type vs. the runtime type
00:00 - 21:0021:00 - 00:00

« first day (866 days earlier)      last day (3283 days later) »