I want normal cancel functionality on cancel button click of sfdatepicker footer, I am trying to achieve it by binding command but it is not working. Could any one suggest me any solution for that ?
You can use code like below:
<datePicker:SfDatePicker.FooterView>
<Grid>
<Button Text="Ok"
x:Name="footerViewButton"
Clicked="footerViewButton_Clicked"/>
</Grid>
</datePicker:SfDatePicker.FooterView>
Created in this way, and then create the corresponding method in the ViewModel to achieve logical operations.
Related
I've been searching for days now for a guide on how to create the custom playback controls for LibVLCSharp that everyone seems to talk about, which I never found a guid for.
I simply want to create other buttons with event handlers for the bottom playback control panel, I tried this but throws a System.NullReferenceException exception on startup while getting into break mode...
<vlc:MediaPlayerElement MediaPlayer="{Binding MediaPlayer}" LibVLC="{Binding LibVLC}">
<vlc:MediaPlayerElement.PlaybackControls>
<vlc:PlaybackControls>
<vlc:PlaybackControls.ControlTemplate>
<ControlTemplate>
<Grid>
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
<Button Grid.Column="0" Text="Test 1"/>
<Button Grid.Column="1" Text="Test 1"/>
<Button Grid.Column="2" Text="Test 1"/>
</StackLayout>
</Grid>
</ControlTemplate>
</vlc:PlaybackControls.ControlTemplate>
</vlc:PlaybackControls>
</vlc:MediaPlayerElement.PlaybackControls>
</vlc:MediaPlayerElement>
I want it to act just like the original one (Auto hides, overlays on tapping, etc...) but with my own layout and controls. I also thought about using the existing one and try to override their handler to implement my own code and override the text property for each button to change its icon but no luck of finding any help.
Thanks in advance ^_^
The code you are interested in is here: https://code.videolan.org/videolan/LibVLCSharp/-/blob/3.x/src/LibVLCSharp.Forms/Shared/Themes/Generic.xaml
I also thought about using the existing one and try to override their handler to implement my own code and override the text property for each button to change its icon
That'd be the way to go.
This previous SO question might answer your question: https://stackoverflow.com/a/14217500/4064749
Just create a new Style based on PlaybackControlsStyle, override what you want and then set it on the PlaybackControls element.
I created https://code.videolan.org/videolan/LibVLCSharp/-/issues/309 recently to track the need of a tutorial to customize the MediaElement.
Further docs on style inheritance: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/styles/xaml/inheritance
I finally found the problem which was making exceptions, when I create custom control template which completely correct, the MediaPlayerElement code behind by LibVLCSharp developers itself cannot find the elements with the names defined anymore as they used hardcoded names for the buttons and views instead of using bindings and dynamic setters.
Thus, several workarounds could be made to fix such issue, here are some of my ideas:
Use the generic style documented here and modify it without removing any elements but rather hide them out or overlay them.
Create your own style with controls obtaining the same names of the original ones.
Find a way to modify or maybe create a whole new playback control element using the original one which can be found here and here.
Thanks to mfkl's answer which helped me find out how everything worked under the hood to come up with the explaination, even though this took me a couple of days to figure out.
Greeting,
I'm developing an apps for Windows Phone 8.1 and face some problem with ListView.
I wanted to place a button for the FIRST item in ListView, but it seem like I can't align center the button.
Below is the code I use currently:
<ListView>
<Button Content="Jio!" Height="6" Width="362"/>
<ListViewItem Content="ListViewItem"/>
</ListView>
Adding horizontalalignment='center' just wont work for the button.
The reason I want to do this is because I wanted the button to scroll together with the list, hence I'm placing it inside the ListView.
Please advice what can I do to achieve my purpose, thanks!
I recommend using the ListView.Header content to place such a button instead of adding it as a child directly.
<ListView>
<ListView.Header>
<Button ... HorizontalAlignment="Center" />
</ListView.Header>
</ListView>
By default, the ListViewItems are left-aligned. You will eventually have to replace their Template in order to center-align it (HeaderTemplate Property).
Follow -up to the answer of this question :Add a Load More Button at the end of ListBox without losing Virtualization?
With this example :
<toolkit:LongListSelector ItemsSource="{Binding Items}">
<toolkit:LongListSelector.ListFooter>
<Grid>
<Button x:Name="btnReadMore" Content="ReadMore"/>
</Grid>
</toolkit:LongListSelector.ListFooter>
Is there a way to change his Content by the C# ? (= "ReadMore" and when the itemsource=0 "go back") thank you !
You can bind the value of the Content property to some ViewModel property. This is the best way IMHO:
You would also bind the Command property to some ViewModel command and this will ensure that you correctly set the caption and handle the result.
But beware, you are not supposed to have a button saying "Go Back" which, when pressed, acts as a hardware back button. You are not supposed to emulate such system functionality.
i have a button control in code as
Button>
<Button.Content>
<StackPanel Orientation='Horizontal' >
<TextBlock Text='{Binding ramDay, Mode=TwoWay}' Margin='0,-18,0,0' Style='{StaticResource PhoneTextTitle1Style}'/>
<TextBlock Text='{Binding enDay, Mode=TwoWay}' Margin='15,10,0,0' Style='{StaticResource PhoneTextTitle2Style}'/>
</StackPanel>
</Button.Content>
</Button>
but i want to create as many buttons as user want with different values of textboxes as user want them. but i am unable to find any way, kindly help me.
thanks
Create a custom user control in you project by using this code there. Thereafter in your mainPage in the code behind add the userControl dynamically to the grid present on the UI in a for-loop or any other method which you find suitable to your situation.
I have a WPF XamDataGrid (I'm using the MVVM pattern, xaml below) and I need it to show the record details in another window when the user double clicks on a row. I have the command which gets the job done, but I don't know how to fire it up as I do with buttons. I want to be able to execute the command when the user double clicks a row, so I need to send the double clicked row (or its ID) as a parameter to the comand. Is it possible?
<igDP:XamDataGrid DataSource="{Binding SomeList}">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False"/>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout >
<igDP:FieldLayout.Fields>
<igDP:Field Name="ObjectId" Label="Id" Width="Auto"/>
<igDP:Field Name="Description" Label="Object Description" Width="Auto"/>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
I use MVVM pattern too and write such as:
<igDP:XamDataGrid ItemsSource={Binding Path=StaffList, Mode=OneWay}>
...
<igDP:XamDataGrid.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick"
Command="{Binding Path=EditStaffCommand, Mode=OneWay}"
CommandParameter="{Binding Path=DataItem}"/>
</igDP:XamDataGrid.InputBindings>
...
</igDP:XamDataGrid>
Where EditStaffCommand and StaffList - properties from view model
Take a look at Attached command behaviours (http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/). They allow to bind commands to events.
You can create a behavior to add a binding between your ViewModel’s Command and the Double Click event of the Grid.
See the following post for more information:
http://blogs.infragistics.com/forums/p/67749/343013.aspx#343013