« first day (702 days earlier)      last day (3447 days later) » 

9:25 AM
0
Q: FileNotFoundException was unhandled - But the file is there

MyDaftQuestionsI'm struggling with this. My WPF app, in debug/release works fine. After I publish it, via InstallShield Express, I get a runtime exception and the program crashes. If I choose to debug the program in Visual Studio, it breaks in the RelayCommand which looks like public class RelayCommand : ICom...

 
 
1 hour later…
10:55 AM
Hi all
Wanna ask, if viewmodel inherited ButtonBase, is the view also automatically copy the behavior? I think it's yes, just to make sure.
 
does not sound like a viewmodel
sounds like a control SpexialButton : ButtonBase
 
hmm. silly me.... Btw, what I wanna do is to implement a click routed events to the viewmodel, (and the view too, ofc) - with ease.
since button already pre made that way
 
check out relaycommand
 
so it's mandatory to make my own click routed event right?
in the viewmodel
public static readonly RoutedEvent TapEvent = EventManager.RegisterRoutedEvent(
    "Tap", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyButtonSimple));

// Provide CLR accessors for the event
public event RoutedEventHandler Tap
{
        add { AddHandler(TapEvent, value); }
        remove { RemoveHandler(TapEvent, value); }
}
(copied from "mothership")
 
@MosesAprico no, never do it imo. Sounds like you want commands
Try this
 
11:00 AM
and the reason is? actually, i want my user control to accept click event, just like button
ok i'll take a look
 
I don't want any view stuff in my viewmodels. Makes them hard to test.
 
hmm.
makes sense. but isn't viewmodel should represent the view, so it's "kinda" ok to do it?
(not being a jerk, just for learning purposes)
 
you want a button that invokes a method in the vm when clicked right?
 
@MosesAprico I think of viewmodel as a class that makes things easily bindable from the view
don't worry about asking questions it is np
does the demo run for you?
 
11:04 AM
just extracted it.
i'll take a look first
 
it is old so I don't really know how it is written :)
 
OH, just remember something (kinda out of topic)
why does the first click of a wpf app in my laptop always delays (approx 1 sec)
first click in a control
 
dunno, not sure I have seen it
 
right? It seems I haven't experience it in a wpf app without data binding (some years ago)
is there something, somehow, because of data binding usage
(sounds absurd, if yes)
 
dunno, would be surprised
 
11:10 AM
hmm
i've took a look at it
questions
public RelayCommand(Action<object> action, Predicate<object> condition)
{
    _action = action;
    _condition = condition ?? (o => true);
}
IncreaseCommand = new RelayCommand(o => Method(), o => Number < 10);
 
the action is the method call passed in
the predicate is when the button should be enabled
in that case when Number < 10
the objects are part of the ICommand signature
 
ooh, neat.. I never do a method passing before, and wondered somehow how to do it...
 
then you bind the buttons in the view to the commands
the commands are just ordinary classes so they can be tested
 
so, method also has "pointer"?
 
Assert.IsTrue(viewModel.IncreaseCommand.CanExecute(null));
 
11:13 AM
to make them "referenced"?
 
yeah, I think capture is the right word here
but I'm not good with all the lingo
 
so, capture is something like method's "pointer"?
np.. just in case it's asked in my presentation
 
maybe pointer is a better word
 
alright then
 
o => Method() is called a lambda
now I usually write _ => since the o is not used but that is just a convention
 
11:16 AM
yup, just like in query stuffs.
 
Action<object> methodCall = o => Method(); // Not sure it compiles
 
btw, what's the difference with delegates?
 
it waraps the call in an object that you can pass around
@MosesAprico just nicer syntax
 
is delegate the collection form of action?
 
same thing
 
11:18 AM
oh i love it. I never understand delegates in my class lol
 
do you use linq?
 
i prefer lambda expression tho. why?
Where(x=>x.IsSelected)
btw, if command automatically refer to "click" or "single click", how do I make similar approach for, say right click?
 
@MosesAprico sample
@MosesAprico right click usually shows a context menu ime
that can be bound to the vm like anything else
 
@JohanLarsson thanks... but it's practically a worse approach as long as it's possible to use ICommand / Action right?
@JohanLarsson thank you.
 
the syntax for lambdas is perhaps a bit hard to learn but well worth it imo
also just copy the DelegateCommand from the sample
or google for another implementation
they are prety much the same
 
11:33 AM
i see
1 more question I think
 
strange that they have not added it to the framework
kinda annoying (that they have not added it)
 
_condition = condition ?? (o => true);
especially the ____ ?? ____
 
it is the same as:
if(condition != null)
{
    _condtition = contition;
}
else
{
    _condition = o => true; // always return true if no condition is passed in (default)
}
just different, shorter, syntax
 
thanks dude. i learned a lot today. so far, that's it for now. Have a great day!
 
 
6 hours later…
5:25 PM
anyone here?
I'm quite confused about the accepted answer chat.stackoverflow.com/rooms/18165/wpf . Can anyone elaborate? google just made me more confused :(
 
you are linking to this chat
 
How do I change the font size of a header in a hubsection?
 
@MosesAprico He binds to the datacontext of the datagrid
the datagrid row has datacontext item in the collection I think
@DemCodeLines I never met a hubsection I think
 
@JohanLarsson hmmm. Is it to make the grid clickable?
 
what is it that you want? A button in each row?
 
5:56 PM
hmm no.. I want to make something like
<Grid Command="{Binding ToggleSelected}"/>
(I know it's not possible that way)
 
draw a mock ui of what you want, paint or something
 
@JohanLarsson maybe I misunderstood the point of the question in my link.
moment
 
To increase font size of those 4 headers
 
OH, I think the mock UI to my case lol
 
@DemCodeLines you can probably style it
<Style TargetType = {x:Type HubThing}> .... </Style>
 
6:01 PM
<Style TargetType="HubSection">
            <Setter Property="FontSize" Value="142" />
        </Style>
doesn't do anything
 
oh sry I derped
try looking for a headerstyle
<HubSection HeaderStyle={StaticResurce YourStyle}...
 
there's no headerstyle, just style and it still doesn't work
 
1
A: Hub.Header template

SankarannUse HeaderTemplate to define Template for Header.. <Style x:Key="HubSectionStyle2" TargetType="HubSection"> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <TextBlock>With Style2</TextBlock> </DataTemplate> </Setter.Value> </Setter> </Style> Get...

 
yeah saw that
 
does not work?
 
6:09 PM
it shows the text, but FontSize just doesn't work
 
set the fontsize on the textblock
<TextBlock FontSize = "72"...
@DemCodeLines does ^ work?
 
@JohanLarsson Yeah, only problem is you have to place that in the page resources at the top and if there are multiple hub sections, then you end up having one piece of code copy-and-pasted several times.
 
nah, lets solve it
there is an app.xaml right?
 
place the style there and remove x:Key="HubSectionStyle2"
then it should be applied to all Hubsections
next is to bind the text
<TextBlock Text={Binding RelativeSource={RelativeSource AncestorType={x:Type HubSection}}, Path=Header} />
Something like ^
 
6:25 PM
If one hub heading is "Image" and the other is "Video", that wouldn't work, because it would place one text ("With Style2") to all of them.
 
41 secs ago, by Johan Larsson
<TextBlock Text={Binding RelativeSource={RelativeSource AncestorType={x:Type HubSection}}, Path=Header} />
 
doesn't allow you to place "Text" property in that textblock.
 
I wrote it in chat, prolly missed something
Text="{Binding, derped the "
 
Yeah, it doesn't allow the use of "Text" property.
 
in wpf it does
 
6:30 PM
never mind
 
never done any phone
 
the quotation mark fixed it.
Says The member "AncestorType" is not recognized or is not accessible.
 
try AncestorType=HubSection} or AncestorType="HubSection"}
or write the binding from scratch
you can use the create binding in VS
 
never did that
 
try it now then
you are writing xaml after all
 
6:33 PM
how
 
put the cursor on TextBlock and check the properties in VS
then for the text property rmb > create binding
the syntax for these bindings is really ugly btw
 
wow,people talking in here on a Sunday
 
@MosesAprico what does it mean?
 
just can't get it to work with ancestortype
 
maybe it is some phone limitation
works in wpf
 
6:41 PM
it's not supported on winphone apparently.
sigh
 
try like this then:
<Style TargetType="HubSection">
  <Setter Property="HeaderTemplate">
    <Setter.Value>
      <DataTemplate TextElement.FontSize="72">
        <ContentPresenter/>
      </DataTemplate>
    </Setter.Value>
  </Setter>
</Style>
 
TextElement is not a property.
 
    <DataTemplate>
        <ContentPresenter TextElement.FontSize="72" />
    </DataTemplate>
@DemCodeLines try ^ then
there must be nicer ways to do this, we are in hack territory here :)
 
yeah, same problem with that too.
i wish there was a better way to do this :(
 
there is, I just don't know it since I don't know phone
 
6:56 PM
where is @ReedCopsey when you need him...
 
yeah, stopping writing code just cos it is weekend is lame :)
 
@JohanLarsson which one sorry?
 
about the mock
 
@JohanLarsson oh, I misread your chat. I think it's for me.
 
I meant draw a sketch of what you want
Then maybe I can tell you how to do it
@MosesAprico ^
 
7:22 PM
What control is there to navigate to an other page?
Like what control is that on the left side ("location", "keyboard" etc.)?
Is that a listview
 
check out NavigationCommands
 
Is there an XAML control for that?
I guess gridview?
 
7:51 PM
gridview sounds wrong if I read the q right
 
@JohanLarsson Well I need a way to create a list like the one above where you click on it and it navigates to another page. Classic menu.
 
ok listbox/listview/itemscontrol then
prolly itemscontrol since you don't want selection
 
8:55 PM
how would i loop a hub?
so when I reach the last hubsection, it takes you back to the first hub section?
 
 
2 hours later…
11:23 PM
anyone still here?
 

« first day (702 days earlier)      last day (3447 days later) »