Communication Commands
Block commands pertaining to communication.

CallPhoneNumber

We're sure you can think of other uses, but wouldn't it be nice if your application had your churches phone number displayed somewhere and the user could just tap on it to call your church office? Yep. That would be nice. If only the user was on a phone or something like that.
The CommandParameter specifies the phone number to be dialed, if it's blank then nothing will happen.
Examples
1
<Button Text="Tap"
2
Command="{Binding CallPhoneNumber}"
3
CommandParameter="15552138874" />
Copied!

SendEmail

With this command you can request to create a new e-mail to be sent to a number of people. Notice that we said "request". This does not immediately send the e-mail but simply uses the OS standard e-mail application. In most cases the user is sent over to the e-mail application and can then later return to your application.
If the CommandParameter is a plain string, then it is used as a comma delimited list of e-mail addresses that the e-mail should be sent to. Alternatively you can specify a SendEmailParameters object and supply the subject, the initial text to use as the e-mail body as well as the list of recipients. This object is described below. Finally, you can also omit the CommandParameter entirely and it will simply open up a new blank e-mail for the user to send.
Property
Type
Description
Subject
string
The subject of the e-mail to be sent, this is optional and the user will be able to edit before it is sent.
Message
string
The body of the e-mail to be sent, this is optional and the user will be able to edit the content before it is sent.
Recipients
List<string>
The e-mail addresses that will receive the e-mail. While this is a list of strings, it also accepts a comma delimited string to specify multiple e-mail addresses at once.
Examples
1
<Button Text="Tap"
2
Command="{Binding SendEmail}"
3
CommandParameter="[email protected]" />
Copied!
1
<Button Text="Tap"
2
Command="{Binding SendEmail}">
3
<Button.CommandParameter>
4
<Rock:SendEmailParameters Subject="Welcome to Rock!"
5
Message="Thanks for saying you are coming to church tonight!"
7
</Button.CommandParameter>
8
</Button>
Copied!
1
<Button Text="Tap"
2
Command="{Binding SendEmail}"
3
CommandParameter="{SendEmailParameters Subject=Welcome to Rock!, [email protected]}" />
Copied!

SendSms

Don't you wish you could add a button with an icon of a chat bubble to your application that would allow your user to send a text message? Yea, we did too. With this command you can request to create a new text message to be sent to a number of people. Notice that we said "request". This does not immediately send the text message but simply uses the OS standard messaging application. In most cases the user is sent over to the message application and can then later return to your application.
If the CommandParameter is a plain string, then it is used as a comma delimited list of phone numbers that the message should be sent to. Alternatively you can specify a SendSmsParameters object and supply the initial text to use as the message body as well as the list of recipients. This object is described below. Finally, you can also omit the CommandParameter entirely and it will simply open up a new blank message for the user to send.
Property
Type
Description
Message
string
The body of the message to be sent, this is optional and the user will be able to edit the content before it is sent.
Recipients
List<string>
The phone numbers of the people who will receive the message. While this is a list of strings, it also accepts a comma delimited string to specify multiple numbers at once.
Examples
1
<Button Text="Tap"
2
Command="{Binding SendSms}"
3
CommandParameter="15551239876" />
Copied!
1
<Button Text="Tap"
2
Command="{Binding SendSms}">
3
<Button.CommandParameter>
4
<Rock:SendSmsParameters Message="Welcome to Rock!"
5
Recipients="15551239876,15552224444" />
6
</Button.CommandParameter>
7
</Button>
Copied!
1
<Button Text="Tap"
2
Command="{Binding SendSms}">
3
<Button.CommandParameter>
4
<Rock:SendSmsParameters Message="Welcome to Rock!">
5
<x:String>15551239876</x:String>
6
<x:String>15552224444</x:String>
7
</Rock:SendSmsParameters>
8
</Button.CommandParameter>
9
</Button>
Copied!
1
<Button Text="Tap"
2
Command="{Binding SendSms}"
3
CommandParameter="{SendSmsParameters Message=Welcome to Rock!, Recipients='15551239876,15552224444'}" />
Copied!

ShareContent

Using the ShareContent command you can open up the standard OS share dialog that lets the user share a piece of text or a URL to other apps and services.
If the CommandParameter is a plain string then it will simply share the text string. Alternatively you can specify a ShareContentParameters object and supply additional options as seen below.
Property
Type
Description
Title
string
The title of the share window (not used on iOS).
Text
string
A text string to be shared.
Uri
string
A URL string to be shared.
ShareAsFile
boolean
Indicates that the Uri should be downloaded to the device and then shared as a file so other applications on the device can be used to open the file.
Examples
1
<Button Text="Tap"
2
Command="{Binding ShareContent}"
3
CommandParameter="Rock ChMS has an app!" />
Copied!
1
<Button Text="Tap"
2
Command="{Binding ShareContent}">
3
<Button.CommandParameter>
4
<Rock:ShareContentParameters Title="Endorse Rock!"
5
Text="Rock ChMS has an app!"
6
Uri="https://www.rockrms.com/" />
7
</Button.CommandParameter>
8
</Button>
Copied!
1
<Button Text="Tap"
2
Command="{Binding ShareContent}">
3
<Button.CommandParameter>
4
<Rock:ShareContentParameters Title="Check out this movie!"
5
Uri="https://upload.wikimedia.org/wikipedia/commons/c/c5/Big_buck_bunny_poster_big.jpg"
6
ShareAsFile="true" />
7
</Button.CommandParameter>
8
</Button>
Copied!
Last modified 3mo ago