« first day (712 days earlier)      last day (3437 days later) » 

6:00 PM
@BrandenBoucher like that ^?
 
Eh, sry @Maverik. That only collapses the header. I'm guessing your datagrid had no data
 
ahh probably same for mine too
 
@BrandenBoucher where did you set the width?
you've only issued width 0 -- where do you actually set it to something else? it should have been part of style
 
@Maverik My code looks pretty much identical to NETscape's
 
sorry i'm not really following chats here.. buried in my own code so just peeking when i'm pinged
 
6:02 PM
np
 
oh wait ok.. yes in netscapes code
its the same issue
 
are you saying I should or should not have a width set on the column itself?
 
he collpases the width but he never sets it - triggers will revert to default style but you don't provide any style width default
should
 
no, changing the headerstyle only changes the header
 
never mind about it reverting, it doesn't collapse the column itself
right, only the header.
 
6:04 PM
Hi everyone!
 
i imagine you'd have to set set the style of all styles available in datagridtextcolumn
 
Well, I could try it on the cell too
 
so, headerstyle, cellstyle, editstyle possibly
 
I have a combobox bound to an enum, which works fine, but when I use an IValueConverter to make the enum value more friendly, there is no longer a default selected item in the combobox. Any ideas? gist.github.com/mrichman/84a05ed7f5d45d897fdc
 
does it try using null as the default selected item
 
6:06 PM
LOL, Well @NETscape, it does collapse everything in the column, but not the column itself!
God Damn It! I don't want to do this in code-behind!
 
haha, what if, for the CellStyle, you set the Visibility to Collapsed?
 
<DockPanel>
        <ToggleButton x:Name="tog" DockPanel.Dock="Top" Content="Clicky" />
        <DataGrid CanUserAddRows="True">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Test">
                    <DataGridTextColumn.HeaderStyle>
                        <Style TargetType="{x:Type DataGridColumnHeader}">
                            <Setter Property="Width" Value="100" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=tog, Path=IsChecked}" Value="True">
that works fine for me
data or no data shouldn't matter to a view
ignore CanUserAddRows - i was testing by adding rows
unless datagrid is messed up!
 
I don't think so Mav, its only change the headerstyle, not the column width
 
argg.. adding data >.>
 
fkit
 
6:09 PM
yea i found the problem
 
i'm not good at ascii art haha
@MarkRichman var result = new List<string>();
you're returning a new List every time it tries to convert a value
 
hmmm...what should I be doing?
 
don't use converter on itemssource
or use original collection
 
well yeah, that works fine, but then I'm unable to make the enum values "friendly"
"UninstallOne" vs. "Uninstall One"
 
6:13 PM
i did it a different way
public enum MyEnum
{
    [Description("This One")]
    ThisOne = 0,
   ...
}
 
ah interesting ok
 
class Description : Attribute
{
    public string Text;
    public Description(string text)
    {
        this.Text = text;
    }
}
 
@BrandenBoucher take a copy of HeaderStyle and apply the exact same thing to CellStyle
 
I did, and elementstyle
 
and you're done.. confirmed by adding some very meaningful data like 1,2,3
<DockPanel>
        <ToggleButton x:Name="tog" DockPanel.Dock="Top" Content="Clicky" />
        <DataGrid ItemsSource="{Binding}">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Test" Binding="{Binding}">
                    <DataGridTextColumn.HeaderStyle>
                        <Style TargetType="{x:Type FrameworkElement}">
                            <Setter Property="Width" Value="100" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ElementName=tog, Path=IsChecked}" Value="True">
if you literally are going to use this piece of code, you may want to make a static resource out of Style
 
6:18 PM
@NETscape so how does that work with IValueConverter?
 
and with that, I'm gonna move
 
        public static string GetDescription(Enum en)
        {

            Type type = en.GetType();

            MemberInfo[] memInfo = type.GetMember(en.ToString());

            if (memInfo != null && memInfo.Length > 0)
            {

                object[] attrs = memInfo[0].GetCustomAttributes(typeof(Description),
                                                                false);

                if (attrs != null && attrs.Length > 0)

                    return ((Description)attrs[0]).Text;
 
@NETscape with you so far...what about the XAML then?
 
i'd think you'd want to use a converter on the itemtemplate
or ItemTemplateSelector? not sure
 
tnx @Maverik but try adding more than one col, like one before and one after. You'll notice it doesn't actually collapse.
 
6:24 PM
so it would be:
MyEnum val = (MyEnum)value
return val.GetDescription();
 
ah ok i think i get it :)
Do I need to implement ConvertBack() ?
 
maybe? i'm not sure
 
ok i'll mess with it
 
i'm just telling you the approach i would try first :)
 
thanks :)
oh.... "value" is a MyEnum[] not MyEnum. Does that matter?
 
6:28 PM
when you're converting the ItemsSource it does
 
right, so how do I avoid creating List<string>
 
if you're converting an itemtemplate or whatever, value should be the type of item the itemssource is bound to
 
ItemsSource is bound to a property of type MyEnum
 
don't use the converter on itemssource... you don't want to convert the entire collection, you just want to convert each item in the collection
 
AH!
<ComboBox Width="100" ItemsSource="{Binding Source={StaticResource ActionFromEnum}}" SelectedItem="{Binding Action, Converter={StaticResource InstallerActionConverter}}" />
instead of what I had with Converter on the Source
 
6:30 PM
@BrandenBoucher dunno how you're doing it but mines working fine wiht multiple columns - in any case you'll have to catch me in early EU morning / afternoon if this doesn't get solved today (with a sample that shows your problem)
 
but when you open the combobox, are all the other items converter?
converted?
 
yep
i just get no default value
oh - and how can your GetDescription() work if val is of type MyEnum?
 
@Maverik, @NETscape
Found it: Visibility="{Binding Source={x:Reference tb}, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}">
f the width
 
@NETscape okay, your thing totally doesnt work lol
@NETscape i absolutely need to convert the ItemsSource, not the SelectedItem
@NETscape or, i need two converters - one for the ItemsSource, and one for the SelectedItem
@NETscape so yeah, i needed two converters. Solved.
 
7:13 PM
i knew you had it in you
 
7:31 PM
protected override Size MeasureOverride(Size constraint)
{
    _border.Measure(constraint);
    return _border.DesiredSize;
}
Why is _border.DesiredSize {0, 0} when constraint is >> 0?
_border = new Border
              {
                  HorizontalAlignment = HorizontalAlignment.Stretch,
                  VerticalAlignment = VerticalAlignment.Stretch,
                  Background = this._transparentBrush
              };
 
8:12 PM
Is there an easy way to generate formatted text for a TextBlock? I know about inlines (Underline, Run, etc.) but I'm wondering if there's some built in way of converting "plain text" style annotations (for example, underline bold /italic/) into a collection of inlines.
Oh great the chat app did exactly what I want and nicely obscured my example in the process!
_underline_
that works
Ok, so for example "This is _underlined_, this is *bold*" => "This is underlined, this is bold"
Dammit everything is italic... well you can maybe guess what I meant!
 
maybe look for a control that handles markdown?
or maybe that is just dumb
 
Markdown. That's the word I was looking for...
I suppose I could just use the RichTextBlock...
 
I'm mucking around in javascript. I'm requesting a URL. I suspect the URL is going to redirect on the server side before providing a response. Any idea how I can detect that?
 
8:37 PM
no idea
@terriblememory maybe you can find a markdown converter or write one
should be doable and niceish
 
@johan Yep, I just started writing one. I could look for something more full featured but it's probably overkill. I'm a noob to this stuff anyway, so it's good exercise.
 
 
1 hour later…
9:44 PM
I think I have something semi nice for simulating mouseover on touch now
The code is not nice yet.
 
9:58 PM
think I'm gonna subclass button for minimum reuse
 
10:24 PM
nope, that turned ugly
 
 
1 hour later…
11:45 PM
@JohanLarsson what container is border in and and is the contents of it?
my answer here stackoverflow.com/a/24636368/1144624 might be similar
 

« first day (712 days earlier)      last day (3437 days later) »