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

00:00
its more a matter of reuse - I always seem to find weird edge cases where changing global template styles doesn't propogate through, etc
@ReedCopsey If you can't, I'd enjoy hearing about a scenario where you got bitten by a subclassed contorl.
@ReedCopsey Ah. Ok.
user controls don't have any of those types of issues - so when you're composing a few controls together (which is basically what you're doing there), it's just 1) much easier/less code and 2) flexible
Ok, that makes complete sense.
but, from a more "practical" level, it's really not a custom control in that you're not really building custom behavior, just composing a view out of existing controls
which is what usercontrol is designed to do
that makes sense to me. Not sure why I didn't think of that...
not my day apparently
00:02
as I said, I almost never, ever, subclass a control or make a custom control
@ReedCopsey Excellent - thanks for sharing your experience.
my company has two products, with probably 3000 screens between them, and I think we have a total of 2 custom controls ;)
we've had more, and almost always invariably end up scrapping them and rewriting them as usercontrols after bugs creep up ;)
Sounds like I should be avoid them....
that's probably the biggest shift in thinking if you're used to winforms
in windows forms, everything required custom controls
in wpf, almost nothing does, since there's a separation between the logic and presentation in the controls themselves
@ReedCopsey I'm seeing that. It's amazing how much you can make a control not look like a control.
I guess I'm going to take a stab at refactoring his subclassed control into a usercontrol.
00:09
writing wpf-controls is fun :)
High bug density though.
I suppose I'll find that out firsthand :)
Already confused; where's the xaml?
@ReedCopsey what do you mean by this... why would you prefer flowdocument > listview
@NETscape more depends on how you want to have things formatted - flowdocument is pretty efficient for embedding content with formatting and imagery, etc
which can make logging scrolls "pop" when needed
ahh gotcha. trying to think of how I would update flowdocument? binding? IO thread reading output target? or something else...
Ok. Well, I suppose it makes more sense if I an a WPF user control, instead of a winform user control.
face palm
00:16
:p
@ReedCopsey or do I implement a ReportError event in all of my models and subscribe to them as i create them
@NETscape You have to write something custom for it, pretty much
How many wpf newbies are you guys seeing in here a week?
depends - some weeks, quite a few
often there aren't many, though
Not many lately
I can only imagine what the c# chat room must get.
00:18
1 to 3 at most
Well, I'll stick around for the long term.
(If you don't mind.)
no problem
me :P
@BrianJ "us" :)
lol I'm getting there, just wish I would have started when I was 12, I'd be rich by now :P
00:23
Ahh... 12. Applesoft Basic!
(I'm not rich. Yet.)
I'm finishing a software degree this year, I'm definitely not rich yet
@ReedCopsey understandable, but not sure how I should approach it. seems like it would be hard to do some kind of binding
@ReedCopsey A usercontrol for a styled button?
@JohanLarsson It looked like it had multiple parts that are interactive from the pic
plus he wanted custom DPs in place
ok maybe I read it wrong
00:26
Anyone have any advice on how to query an Azure mobile service? I have code to push to the database, but can't find any examples on how to read/select data from it..
you probably did. Reed is always right... he does not misunderstand
I thought it was button with multiple content
@NETscape star
@BrianJ Azure SDK?
that sounds like it would have 1000 tutorials after a google search
@BrianJ Is WPF taught in one of your classes, or is this a side-thing?
00:29
@JohanLarsson It's a button -- there are three attributes -- font, key-character, and description.
@JohanLarsson Interactivity is limited to that of a button.
@NETscape you might be on to something there ;)
@JohanLarsson But it does need to be able to set the font of the one text item dynamically based off of the one attribute.
@ReedCopsey Would Johan's attached property pattern work?
(as opposed to going with a usercontrol)
probably - but attached properties are less maintainable for most scenarios
I use them, but I try to use them for things where there isn't another approach
@LynnCrumbling no we learn Win Universal and Win Phone, but no WPF. I had to use WPF as a last resort because I couldn't use a vital library needed for my project with Windows Universal. I don't mind it now :)
You should learn WPF first anyways
00:33
yeah but the whole thing of having "apps" for our portfolio looks better on a cv
Ok, headed out for the night. Thanks again...
@BrianJ depends on where you apply - having windows apps is probably less impressive than wpf desktop apps
though iOS or Android would be a different story
we do Android also, I think its mainly windows because there is an affiliation with the college
00:50
anybody can help me out pulling out the HierarchicalDataTemplate from TreeView.ItemTemplate and write it down as a Style. I can't seem to figure out the xaml syntax for it :/
Why would it be a style?
it seems quite simple
  <DataTemplate x:Key="CommandsTemplate">
    <TreeView IsTabStop="False" Margin="6,2">
      <TreeView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding Commands}">
          <TextBlock Margin="2,6">
            <Hyperlink Command="{Binding Path=Command}">
              <TextBlock Text="{Binding Path=DisplayName}" />
            </Hyperlink>
          </TextBlock>
        </HierarchicalDataTemplate>
      </TreeView.ItemTemplate>
    </TreeView>
  </DataTemplate
Why not just use it as a template?
and I would want to fit it in the DataTemplate.Resources instead
00:52
@BradleyDotNET I tried so many variations but non of them seem to be right. VS doesn't like them
I hit the wall the moment I get to HierarchicalDataTemplate
Ok, trying something to make sure I'm not crazy...
@BradleyDotNET thanks :) you definitely would need a VS
The latest I tried was this
  <DataTemplate x:Key="CommandsTemplate">
    <DataTemplate.Resources>
      <Style TargetType="TreeView">
        <Setter Property="ItemsSource" Value="{Binding}" />
        <Setter Property="Template" >
          <Setter.Value>
            <ControlTemplate TargetType="TreeViewItem">
                <HierarchicalDataTemplate ItemsSource="{Binding Commands}">
but nope :D
But why do that as a style?
As I said I am definitely wrong. So it doesn't even work that I defend it :)
This works by the way (or at least no complaints):
<DataTemplate x:Key="CommandsTemplate">
            <DataTemplate.Resources>
                    <HierarchicalDataTemplate x:Key="HeirarchicalTemplate" ItemsSource="{Binding Commands}">
                        <TextBlock Margin="2,6">
            <Hyperlink Command="{Binding Path=Command}">
              <TextBlock Text="{Binding Path=DisplayName}" />
            </Hyperlink>
          </TextBlock>
                    </HierarchicalDataTemplate>
            </DataTemplate.Resources>
            <TreeView IsTabStop="False" Margin="6,2" ItemTemplate="{StaticResource HeirarchicalTemplate}">
sorry for the crappy indentation
00:55
Oh, you mean why I am trying to do the whole thing
copy-paste from VS
I was trying to make it a style so rather than setting it straight then I can apply a trigger to it @BradleyDotNET
as you taught me in the past, triggers can't overwrite the properties set in the body of the Control and I am following that
Ok... give me a sec, it still should work
@BradleyDotNET This definitely doesn't have any errors, but I don't know how to apply a trigger to it :)
Oops... Okay I'll stop pinging :)
        <DataTemplate x:Key="CommandsTemplate">
            <DataTemplate.Resources>
                <Style TargetType="{x:Type TreeView}">
                    <Setter Property="ItemTemplate">
                        <Setter.Value>
                            <HierarchicalDataTemplate ItemsSource="{Binding Commands}">
                                <TextBlock Margin="2,6">
                                <Hyperlink Command="{Binding Path=Command}">
                                  <TextBlock Text="{Binding Path=DisplayName}" />
still compiles for me
01:01
I bet I tried that. If it works, it's your magic @BradleyDotNET :D
Bang ON... it works like a charm
see.. magic :)
: ))))
Thank you so much... I literally tried 20 different things... ItemTemplate, Template applied it to TreeView or it's Items ... but just didn't want to work
really appreciate it. was just about to give up
01:22
No problem
One of those things you learn with time I guess :)
@Mehrad Even on your second attempt you were missing the {x:Type} from your target type
not sure if that had an effect
And you were doing something weird with the control template
:)
I reckon I was starting to check some really weird stuff
looks like it :)
@BradleyDotNET do you know how can I hop out one level from Binding ?
I'll show you
Say in the example that you fixed for me
        <HierarchicalDataTemplate ItemsSource="{Binding Commands}">
          <TextBlock Margin="2,6">
                            <Hyperlink Command="{Binding Path=Command}">
in the first tag I am binding to Commands
01:30
right
and in the seconds I am binding to some properties in the Commands
How can I access something outside of the first Binding I did when i am one level in
seems I can't access the properties in the same level as Commands when I am in one tag level down
donno if I make sense
Could you provide an example?
something visual like
Binding = foo
    Binding = foo.name
    Binding = baz // Error
if foo and baz are from same class
if I am not making sense I can find an actual example
01:34
No I get you now
THere are a couple ways
none super pretty
I am all ears :)
Is it even a right thing to do ?
That depends
on the whole, its a weird thing to do
maybe I need a strategy change
The first would be to bind with Source={RelativeSource TemplatedParent} and a path of DataContext.Baz
did you want me to show you the exact example then you might suggest a whole change ?
01:36
note, I'm not great with RelativeSource
so take it with a small grain of salt
I have heard of RelativeShource
You can do something similar with ElementName
The cleanest from a XAML point of view would be to give child items parent knowledge
never heard of this one.
then you just do Path=Parent.Baz
ElementName?
yep
01:38
You can bind to a property of any named control
like this:
is it a tag?
Text="{Binding ElementName=myControlName, Path=SomeProperty}"
Oh.. nice
Make that property off the DataContext and its the same as before
so it's like binding to another Contorl
01:39
If you are outside the visual tree (say in the resources) use Source={x:Reference myControlName} instead
right
super useful for SelectedItem and Master/Detail
that's right
My x reference may be a bit off, but its close :)
Hard to do this from memory :(
if I have a clue I'll figure it out (hopefully) :D
You don't need that variation too often anyways
I know this is quite a strange situation I am facing
01:43
Commands (in data templates) are when you normally do that
so its not that un-common
apparently since I have a Content="{Binding Path... for my HeaderContentControl, in the DataTemplate which I am trying to paint it a UI I can't bind to any other properties of same level
@BradleyDotNET exactly. this is a DataTemplate and I tried to put a button on it
The real problem is that the data context changes in a data template
so you use ElementName or similar to get out of that data context
Yes. if I can pull myself out of that tree level I can access the rest again
Right
Anyways, time for me to head home. Talk to you tomorrow!
Thanks Brad
have a good one
and also it worked like a charm
 
6 hours later…
08:02
Moornign
 
1 hour later…
09:12
@LynnCrumbling I don't love attached properties btw. Just showed it as it is one way to solve the problem.
They are nice to know about.
09:34
Hi.
Is it possible to bind parent's property to child property?
<Parent Prop="{Binding ElementName=child, Path=ChildProperty}">
    <Child x:Name="child" ChildProperty="1"/>
</Parent>
Something like that.
I could do a two-way binding from child to parent, but in my case Child's property is readonly.
09:58
@Denver - no :(
Googled around for this the other day. Its unforunately not possible
At least not using the markup
Well yeah, I am trying to avoid code-behind.
Yeah I tried that too :D
I am using Extended WPF Toolkit's Zoombox, and it's property Viewport is readonly. Plus you can't inherit Zoombox cuz its sealed. Sigh...
If you find a solution let me know, I gave up and worked around it
Was going to post an answer on SO. :)
10:02
Well if you think about it. Its bad practice. Because the way WPF is defined, almost anything can go inside of anything
You are almost making assumptions about the contents in your view if you start expecting children
Maybe thats the reason it was never implemented
Yes, I think in the same way.
I cant get this binding working: :(
<Setter Property="Command" Value="{Binding DataContext.CreateNodeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
I need to bind to the datacontext of the context menu
Tried ElementName?
ContextMenu Name="cm"...
<Setter Property="Command" Value={Binding ElementName=cm, Path=...
That may just work
forgot about that
Tho you are editing a style, and I am yet to understand how styles and templates work. Might it be that style will not see the name of parent?
10:09
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=NodeGraphRightClickMenu'. BindingExpression:Path=DataContext.CreateNodeCommand; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'Command' (type 'ICommand')
<Setter Property="Command" Value="{Binding ElementName=NodeGraphRightClickMenu, Path=DataContext.CreateNodeCommand}"/>
Hm...
ItemsSource screws me over
So did you find a mistake?
No
Ill have to do a workaround in code
Ah no I cant
Grrrr
10:37
Does not ItemContainerStyle inherit DataContext from ContextMenu?
Can't you just write:
<Setter Property="Command" Value="{Binding CreateNodeCommand}/>
Ive found it
<Setter Property="Command" Value="{Binding DataContext.DataContext.CreateNodeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
Lol wat
Oh lol.
Well, I guess it makes sense. :D
I've created an answer about my problem on SO, if you are interested: stackoverflow.com/questions/28852077/…
Aw man now my multi binding isn't working!!
Fixed
I love stack overflow
10:56
Everyone does. :)
11:27
Wow, that guy from SO totally misunderstood me and marked my question as duplicate.
if Lol
Whatever. :\
At least I got my answer anyway.
Impossibru.
11:53
@Asheh I think you can get rid of the "DataContext.", it can be implicit
 
1 hour later…
12:59
Does any one have an idea on animations for WPF charts??
I need them to use to my work, but could not able to get a good ones
Could some one, help me out on the same?
 
2 hours later…
14:52
@Ganesh what do you mean
15:18
I need some animation to do for different kinds of charts
for that I am using the Story board and Doube Animation
but for LineSeries, I cannot product the good animation
@JohanLarsson I appreciate you taking the time to document an example...
@Ganesh so when a new data point is added, you need to animate the drawing?
so like it would show a line behind drawn from one point to the other, rather than just connecting point-to-point
16:08
o/
I'm not sure if Reed or Brock is the more american sounding name.
What's next? A Chester showing up to chat?
16:21
Brock is Japanese, clearly
pokemon
Whoooa now I'm 'murican
16:46
sounds Canadian -_-
17:34
morning NETscape
heyooo
how are you
doing alright
writing a UI plugin interface this morning
how are you?
18:02
good good. about to get another milestone complete today i think
question though @BradleyDotNET... how do you write clean code when each statement is dependent on the previous statement
short circuit?
bool successful = GetValueHere();
if(!successful)
    return;
successful = GetValueThere();
if(!successful)
    return;
combine methods?
I'm not a huge fan of short-circuiting
but thats just my style
I don't have a problem with:
yeah same here
if (GetetValueHere())
{
      if (GetValueThere())
      {
      }
}
I know some people hate nested if statements
but I find that pretty easy to read
Of course, if the code was that simple, there's always
if (GetValueHere() && GetValueThere())
Which will short-circuit
and is still readable/normal flow
right
me and you feel the same
its mostly like,
var retCode = 0;
var success = TryThis();
if(!success)
    retCode = ErrorCodes.TryFailed;
    return;
...
so I think I'll just go with nested if else
18:18
@NETscape Monads FTW!
@JohanLarsson lol - Reed is a very British name :) Though it's been in my family, in the americas, for quite a while now, too
@ReedCopsey get your black magic our of here! ;)
I'd use nested if statements, unless there are a lot of checks
when you start getting very deep, it gets ugly
yeah
agreed
monadic flow fixes that - you can just write it one line after the other, and lift the result out at the end
but that's non-trivial in C# ;)
@ReedCopsey looking at santialbo.com/blog/2013/03/27/monads-in-f-sharp ... why would you do
/// Applies parsers p1 and p2, returning the result of p2.
let (>>.) p1 p2 : Parser<'b> =
    p1 >>= (fun _ -> p2)
why apply both when you only return one?
18:26
I wouldn't do that ;)
I find all of the custom operators just make life complicated
yeah
Have you tried XamlStyler Reed?
I can recommend it. Ctrl + K + 2 does nice things for formatting.
Attribute per row gives nice merges.
18:58
I hadn't used it, but looks reasonable
I have used it much, never broken my xaml.
R# breaks my xaml sometimes
19:29
Things are either terrible or reasonable. Nothing else, ever.
20:16
so true
20:47
hey @MarkW
howdy
hey @BradleyDotNET @ReedCopsey 3rd party API returns a ushort[] after I call it. ReadValues(device, address, numRead). I want to write a wrapper for it ReadSingleValue(device, address) that returns ushort... how should I do that you think?
long time no see
Hello
@NETscape pass 1 and just return results[0] ?
20:49
been super busy with onsite visits... gunna be gone all next week too :(
//in ReadSingleValue
ushort[] values = ReadValues(device, address, 1);
return values.Any() ? values.First() : ushort.MaxValue;
?
ahh forgot
i also want to prevent trying to read if address == ushort.MaxValue
or should that be done outside the wrapper
i didn't want to do that because it'll add a lot of ugly code
weary and covered in soth I raise from Google mine after a whole day: I can't find one god damned simple tutorial on how does WPF Layout pass steps work. : [
Unbelievable.
var val = address != ushort.MaxValue ? ReadValues(device, address, numRead) : (ushort)0; ... 10 times in a row in ugly
@Riva what do you mean?
1. Measure
2. Arrange
3. UpdateLayout
20:53
@NETscape I can explain ..
each control defines their own implementation
Inside the wrapper seems fine
and all the source code is publicly available for controls
@NETscape ReadValues can return nothing?
(ie: an empty array)
20:55
I need to know what will I get as availableSize on Measure when my custom FrameworkElement has different W/HAlignments set.
And what is expected I'll return. ..
first result is pretty good
@ReedCopsey I have been Googling it whole day. Didnt find that informations.
1st result (which I read a year ago and again today) explains very little imho
00:00 - 21:0021:00 - 00:00

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