Skip to content

Commit 27bf7b7

Browse files
committed
Added drawer resource template content and image in ug
1 parent bd9087b commit 27bf7b7

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
92.6 KB
Loading

MAUI/Scheduler/resource-view.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,62 @@ N>
374374
* The BindingContext of the `AdaptiveHeaderTemplate` is the `SchedulerAdaptiveResource.`
375375
* The `ToggleResourceDrawerView` method should be called on the `SchedulerAdaptiveResource` instance obtained from the control’s BindingContext. It toggles the visibility of the drawer resource view. It is used only when the `AdaptiveHeaderTemplate` is applied.
376376

377+
### Customize drawer resource appearance using DataTemplate
378+
379+
The drawer resource appearance customization can be achieved by using the `DrawerResourceTemplate` property of [SchedulerResourceView](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Scheduler.SchedulerResourceView.html?tabs=tabid-13%2Ctabid-6) in the [SfScheduler](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Scheduler.SfScheduler.html).
380+
381+
{% tabs %}
382+
{% highlight xaml tabtitle="MainPage.xaml" %}
383+
384+
<ContentPage.Resources>
385+
<DataTemplate x:Key="drawerResourceTemplate">
386+
<Grid Background="{Binding DataItem.BackgroundBrush}">
387+
<Label Margin="10" FontAttributes="Bold" Text="{Binding DataItem.Name}" TextColor="{Binding DataItem.ForegroundBrush}"/>
388+
</Grid>
389+
</DataTemplate>
390+
</ContentPage.Resources>
391+
392+
<scheduler:SfScheduler x:Name="scheduler">
393+
<scheduler:SfScheduler.ResourceView>
394+
<scheduler:SchedulerResourceView DrawerResourceTemplate="{StaticResource drawerResourceTemplate}">
395+
<scheduler:SchedulerResourceView.Mapping>
396+
<scheduler:SchedulerResourceMapping
397+
Id = "Id"
398+
Name="Name"
399+
Background="BackgroundColor"
400+
Foreground="ForegroundColor"/>
401+
</scheduler:SchedulerResourceView.Mapping>
402+
</scheduler:SchedulerResourceView>
403+
</scheduler:SfScheduler.ResourceView>
404+
</scheduler:SfScheduler>
405+
406+
{% endhighlight %}
407+
{% highlight c# tabtitle="MainPage.xaml.cs" %}
408+
409+
public class Employee
410+
{
411+
public string Name { get; set; }
412+
public object Id { get; set; }
413+
public Brush BackgroundBrush { get; set; }
414+
public Brush ForegroundBrush { get; set; }
415+
}
416+
417+
var Resources = new ObservableCollection<Employee>()
418+
{
419+
new Employee() { Name = "Sophia", Id = "1000", BackgroundBrush = Brush.PaleGreen, ForegroundBrush = Brush.Black },
420+
new Employee() { Name = "Zoey Addison", Id = "1001", BackgroundBrush = Brush.SkyBlue, ForegroundBrush = Brush.Black },
421+
new Employee() { Name = "James William", Id = "1002", BackgroundBrush = Brush.LightPink, ForegroundBrush = Brush.Black },
422+
};
423+
424+
this.scheduler.ResourceView.Resources = Resources;
425+
426+
{% endhighlight %}
427+
{% endtabs %}
428+
429+
![customize-drawer-resource-template-in-maui-scheduler](images/resource-view/customize-drawer-resource-template-in-maui-scheduler.png)
430+
431+
N> The BindingContext of the `DrawerResourceTemplate` is the [SchedulerResource.](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Scheduler.SchedulerResource.html) and the custom data object can be bound in `DrawerResourceTemplate` by using `SchedulerResource.DataItem`.
432+
377433
## Visible Resource Count
378434

379435
The number of resources shown in the day, week, work week, timelineday, timelineweek, timelineworkweek views can be controlled using the [`VisibleResourceCount`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Scheduler.SchedulerResourceView.html#Syncfusion_Maui_Scheduler_SchedulerResourceView_VisibleResourceCount) property of the [`SchedulerResourceView`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Scheduler.SchedulerResourceView.html#Syncfusion_Maui_Scheduler_SchedulerResourceView_Resources) class. This lets you define how many resources are visible at a time.

0 commit comments

Comments
 (0)