« first day (1211 days earlier)      last day (2938 days later) » 

12:48 AM
@JohanLarsson I'm about to head out for the day, but I did get the columns loading up correctly and no event handlers in the code behind (in an attached behavior instead)
 
A bit more cleanup and I'll post some code tomorrow.
 
 
7 hours later…
7:49 AM
mofning
 
Morning
 
8:32 AM
morning :)
D - 1 :)
 
Yaris :D
 
D - 1?
 
tomorrow morning, I'll get my new car :D
 
9:26 AM
ahaa
 
 
2 hours later…
11:55 AM
nothing to do this the afternoon :D
 
 
1 hour later…
1:07 PM
lucky you :)
 
1:29 PM
Hi Every body,
I try to use dependency properties in wpf
but It didn't get update
 
can you create a gist with the code ?
 
I have a local dependency property and bind it to element property, but is doesn't update
sure
this is my control I designed
<local:UCVoltage x:Name="UCVoltage" Value="{Binding Vout}" />
and I want to bind the Value property to local variable
 
can you show us the code for the Value DP ?
 
in code behind and in the windows load
UCVoltage.DataContext = CurrentRtuStatus;
I set the datacontex
and this is my dependency property
public tbl_RtuStatus CurrentRtuStatus
{
get
{
return (tbl_RtuStatus)GetValue(CurrentRtuStatusProperty);
}
set
{
SetValue(CurrentRtuStatusProperty, value);

}
}

public static readonly DependencyProperty CurrentRtuStatusProperty =
DependencyProperty.Register("CurrentRtuStatus", typeof(tbl_RtuStatus),
typeof(MainWindow), new FrameworkPropertyMetadata(null) { BindsTwoWayByDefault = true });
the CurrentRtuStatus is my variable
 
typeof(MainWindow)
 
1:36 PM
but it doesn't update automatically
 
should be typeof(UCVoltage)
i.e. the type of the control which implements the property
 
let me check it
@franssu thank you
 
you're welcome :)
 
I didn't have enough attention
 
it's also strange you have access to the namespace of MainWindow from within your custom control
 
1:49 PM
@franssu because I using Usercontrol
 
what I mean is, your usercontrol shouldn't even see MainWindow
 
@franssu I don't know
 
they shouldn't even be in the same project IMO
 
a project for UCs ?
 
2:05 PM
why not ?
 
I do the same thing :D
 
Huh. It's fascinating to be a fly on the wall for some of these discussions.
 
2:28 PM
the thing is, why define a custom DP
when you can get the value through datacontext ?
 
@franssu I did that the first time I tried to pass DC. Then, of course, the "oh, duh" moment.
 
IMO there's two kinds of UCs : the ones used once and getting value through datacontext, and reusable ones getting values through DP ?
 
3:02 PM
ok... MultiBinding converter issue:
(eh, hang on)
 
I have come to conclusion that there should be one type of UC, the one that represents a view (Multiple Controls) and has a ViewModel. If you want to have some simple DP to bind some data you want to change, int or string, use CustomControls instead.
 
disagree :)
 
now can I find a good reason why I disagree is another thing :)
nice @JohanLarsson
 
Not sure it is useful for anybody, not even us :)
 
3:07 PM
I don't know what a property grid is :)
 
It's a grid... for properties.
(grin)
 
company blocked imgur the last hour
was going to post a gif of the grid but no
ha, workaround!
 
why is there "old value:" when there is no old value ?
 
old value was null
 
yes
 
3:11 PM
poorly formatted perhaps
hesitated to include it in the default style
 
@franssu I don't have arguments for my affirmation either :)
 
@JohanLarsson, I don't know if you did it intentionally or not
for validation, you use your library ?
 
nice :)
 
Gonna rewrite & publish the undoscope thing soon
And fix the bug in modern that @Julien found.
That one has been low prio for a while
 
3:18 PM
Do you think that units of measure can be supported in C# ?
 
Feels like it should be possible but dunno.
@Hamza_L this goes a long way ime.
I added a package with setting controls for units also
So that you can never show mm to the user but convert to metres
 
that's great
:D
 
Really nice to keep quantities typed, eliminates so many bugs
And makes the code clear
 
yes
 
keep everything typed
 
3:23 PM
but if it's supported like in F#
it will be great
 
posted on February 12, 2016 by ericlippert

You are in the kitchen of the white house. A table has recently been used for the preparation of food. A passage leads west and a dark staircase leads upward. A chimney leads down and to the east is a … Continue reading →

 
3:39 PM
Ok...
MultiBinding issue:
I have a multibinding that passes two items: (1) an underlying bool that the ToggleButton was previously bound to for IsChecked and (2) an Listbox's HasItems value
                <ToggleButton.IsChecked>
                    <MultiBinding Converter="{StaticResource BrowsingACLAllowAllDomainsConverter}">
                        <Binding Path="defaultActions" />
                        <Binding ElementName="BAL_List" Path="HasItems" Mode="OneWay" />
                    </MultiBinding>
                </ToggleButton.IsChecked>
The converter is throwing an error on ConvertBack:
System.Windows.Data Error: 8 : Cannot save value from target back to source. BindingExpression:Path=HasItems; DataItem='ListBox' (Name='BAL_List'); target element is 'ToggleButton' (Name='PagesModeToggle'); target property is 'IsChecked' (type 'Nullable`1') InvalidOperationException:'System.InvalidOperationException: 'HasItems' property was registered as read-only and cannot be modified without an authorization key.
Obviously, HasItems is bound one way.
Converter code:
    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        bool AllowAll = System.Convert.ToBoolean(value);
        return new object[] { (AllowAll ? Shared.KioBrowsingACLBase.AclActions.Allow : Shared.KioBrowsingACLBase.AclActions.Block), true };
    }
If I try changing object[1] to return Binding.DoNothing, the whole things fails to bind anything.
 
<MultiBinding Mode="OneWay"..
?
 
then it wouldn't matter if user sets ischecked
 
@JohanLarsson no way!!!
 
if that was the case.
 
right :)
 
3:44 PM
@franssu Yeah, I need IsChecked to still be bound two-way :-/
I hate that it re-pings for each edit. Sorry.
 
why do you need the binding on has items ?
 
Logic:
return ((!ListBox.HasItems) || (ListBox.HasItems && Some_property==Something);
 
can't you have the VM do the logic ?
 
The toggle button should reflect the state of the boolean UNLESS the listbox is empty, in which case it should return true all of the time.
 
vm sounds nicer than multiconverter
 
3:48 PM
I've tried that; I'm running into an issue where INPC is getting in the way. The vm has a boolean that wraps the bool... but the actual value instance is down in the model...
and since the model never updated the vm, it doesn't know it changed.
So now I'm going this route.
 
why doesn't the model update the VM ? :)
 
did you ponder the trigger route?
 
I would much prefer the other approach.
Oh .. I completely forgot about that.
Too much portal ;)
 
4:17 PM
Hi guys, I have a observable collection which display rows of data in a grid, is there a way to count the number of rows which are selected?
 
what type is the grid
 
datagrid
 
doesn't it expose the selected items ?
 
it does for a single selected item
 
System.Windows.Controls.DataGrid  ?
 
4:35 PM
@user1892991 you'd put IsSelected property in your "items" and bind IsSelected in VM to IsSelected on DataGridRow
then do Items.Count(x=> x.IsSelected);
though if there is virtualization, it gets ugly, and then you use a behavior
 
4:50 PM
IObservable<T> IObserver<T> look awesome. blah
 
thanks guys :D
 
 
2 hours later…
6:42 PM
val.Format("%c%c", HIBYTE(value), LOBYTE(value));
what is the C# equivalent. i seem to have gone full stupid
 
what do you mean separate? previous data.... are your items a linked list or something?
 
@NETscape Just an ObservableCollection<T> bound to ItemsControl.ItemsSource
 
@Jeremy is this this working? Binding="{Binding RelativeSource={RelativeSource PreviousData}}"
 
@NETscape Indeed
 
i mean how*
PreviousData
 
7:18 PM
@NETscape Proof (I set the height on the separator to 100 px, removed all other info to protect the innocent)
 
no i believe you
but where is PreviousData coming from @Jeremy?
 
I think it's just as mysterious as the other RelativeSource options there
WPF magic
Somewhere, WPF says "oh, this view thinks it's looking at an element in a list - sure enough, there it is, better grab the previous element for it"
 
thats pretty sweet. never heard of it
i approve
 
Feels like it should be in the container style instead, though, but I don't really mind it here I guess.
 
probably, but then you have to add a bunch of xaml, lol
well, more xaml than if you did it the way you posted
 
7:23 PM
Yeah... :(
 
you're right it does make more sense. you could just have a normal datatemplate in the itemtemplate if you put it in the style. throwing in a contentcontrol in there starts making it not so intuitive
and you could probably use ContentPresenter
instead?
 
OH yeah
Should obviously use ContentPresenter lol
 
@Reed do you use a lib for undo/redo in a form?
 
I'll play with it a bit later... Like the way this looks, would like to wrap it into a style
@JohanLarsson Ooh, I like this question.
I was going to play with this later...
 
@Jeremy here is a prototype.
Gonna clean it up/rewrite it
 
7:32 PM
@JohanLarsson Nope
wouldn't really want to, either -
in general, with my newer approaches, undo comes for free ;)
 
@ReedCopsey How is that?
Seems like any approach to undo/redo at least requires a fair amount of code, but maybe I've overlooked something...
 
@Jeremy As you approach a more pure FRP design, rolling back state becomes trivial
at an extreme you have things like Elm, which has full time travel debugging support ;)
roll back, change a value, roll forward and see the differences, etc
 
Ah, that makes sense.
In imperative-land, that'd just look like plugging into the binding somehow.
Which is what @JohanLarsson seems to do.
I just forgot that WPF doesn't mean C# for you :^)
 
;)
well, I'm been considering porting my newest stuff to C#
so C# developers don't have to suffer with MVVM ;)
should be able to make it work in a LINQ-style
 
8:22 PM
@ReedCopsey not with nice ux, jumping to the textbox being undoed setting caret pos etc
@Jeremy Pretty messy, was prototyping
 
@JohanLarsson I work on an application that doesn't have vm-level undo/redo, though i think it could benefit quite a bit from it. I'm planning to explore how close I can get to plug-and-play undo/redo. I know it's not going to be easy.
 
if you do textboxes only it is not that hard I think
selectors and checkboxes have no support in the framework
 
@JohanLarsson Lots of other stuff
@JohanLarsson In your implementation, you mean, right?
 
in wpf
textbox has nice built-in support for undo
 
@JohanLarsson Yeah, but I can't think of too many controls where it's a big challenge to implement undo yourself
 
8:37 PM
@JohanLarsson True
 
 
1 hour later…
9:47 PM
Another tricky issue with DataGridTemplateColumns. For the CellTemplate, I wrap the contents in a <Border>, but that border disappears if part of the cell is scrolled off of the viewable area. Any ideas why?
Let me know if pics would help
 
@BrandenBoucher What does Snoop tell you?
 
one min
@Jeremy, I don't see any properties change on the border when it "disappears"
 
@BrandenBoucher mmm, weird. can you get a simple reproducible example into a gist to poke at?
 
10:05 PM
@Jeremy, let me get back to you in like 5 on that
 
@BrandenBoucher No rush - burying myself in other stuff at the moment anyway
But I'll take a look eventually... :)
 
Thank you
 
10:25 PM
@Jeremy, I think I found out the reason
Because I am setting my Border's Margin to -2 all the way around so that the borders of each cell look nice
 
10:39 PM
@BrandenBoucher aaaaaah negative margins
 
ya, they work fine for the headers, but not the cells
 
...I say no less than 30 minutes after I added negative margins for something lol
 
yeah you're right they should be in an adorner but what are you going to do call the wpf police on me?
:^)
 
None of mine are. Because, well, why?
 
11:06 PM
Eh, for my case it should probably be in adorner
 

« first day (1211 days earlier)      last day (2938 days later) »