Using Font Awesome in MVC5 Html grid column - asp.net-mvc-5

I am attempting to use Font Awesome in my MVC5 Html grid, as shown in my code segment below. On executing the code below, the grid renders correctly but the text within the #Html.Raw() declaration is displayed in the cell on the grid, as opposed to the Font Awesome icon. I am using Font Awesome elsewhere on the view, outside of the grid and the icons render correctly, so I'm confident that Font Awesome is installed and configured correctly.
#helper CustomRendering(Customer customer)
{
if (customer.RequiresAssistance)
{
#Html.Raw("<i class=\"fab fa-accessible-icon\"></i>");
}
}
#Html.Grid(Model).Columns(columns =>
{
columns.Add().RenderValueAs(o => CustomRendering(o));
})

#Html.Grid(Model).Columns(columns =>
{
columns.Add().Sanitized(false).Encoded(false).SetWidth(15).RenderValueAs(o => CustomRendering(o));
})

Related

React Navigation 6 - Padding issue

I am working with #react-navigation/native 6 and using the headerLargeTitle option.
Depending on the screen size the padding of the title is changing. I could not find solution to adjust this through the documented APIs.
Any idea?
import { createNativeStackNavigator } from '#react-navigation/native-stack';
const PortfolioStack = createNativeStackNavigator();
const PortfolioStackScreens = (): JSX.Element => {
return (
<PortfolioStack.Navigator>
<PortfolioStack.Screen
name="Portfolio"
component={PortfolioScreen}
options={{
headerLargeTitle: true,
headerShadowVisible: false,
headerLargeTitleShadowVisible: false,
}}
/>
</PortfolioStack.Navigator>
);
};
Thank you
Whether to enable header with large title which collapses to regular header on scroll.
For large title to collapse on scroll, the content of the screen should be wrapped in a scrollable view such as ScrollView or FlatList. If the scrollable area doesn't fill the screen, the large title won't collapse on scroll. You also need to specify contentInsetAdjustmentBehavior="automatic" in your ScrollView, FlatList etc.
Only supported on iOS.
Detail

React Hide Component when Mobile Keyboard open

I'm wondering if there is a way to hide React components (Ex. Bottom Navigation Bar Component) while the mobile (Andriod, iOS, etc. ) Keyboard is open on the screen.
Currently I'm doing it with a:
#media (max-height: 400px) {
.navclass {
display: none;
}
}
but am wondering if there is a JS Event or similar.
When am input element is focused on devices of inbuilt keyboards, the keyboards pops up.
ReactJS allows you to write Normal JavaScript in your code.so what you can do is to
this.state = {
isNavVisible: true
}
You can now pass this dynamically as a prop on the components and set it to the style of the wrappers element as an inline style in the components main file.
You can then write a function on your inputs or elements that takes focus:
const disableNav = () => {
if(windows.innerWidth <= 400){
this.setState({isNavVisible: false})
}
}

How to place svg icon in toolbar

I need to replace all of my png icons with with svg - it is my employee request. I am using FFImageLoading. Some of the icons displayed in Pages are displaying properly but the problem is that I can't display svg icon in toolbar (toolbar item and hamburger icon).
I am using Xamarin.Forms 4.3.0.908675 and Xamarin.FFImageLoading - all in version 2.4.11.982.
My logo.svg is placed in MyProject.EmbeddedFiles.Images.
Here are the code samples I tried:
ToolbarItems.Add(new ToolbarItem
{
IconImageSource = "logo.svg",
Order = ToolbarItemOrder.Primary
});
ToolbarItems.Add(new ToolbarItem
{
IconImageSource = "MyProject.EmbeddedFiles.Images.logo.svg",
Order = ToolbarItemOrder.Primary
});
ToolbarItems.Add(new ToolbarItem
{
IconImageSource = ImageSource.FromResource("MyProject.EmbeddedFiles.Images.test.svg", typeof(App).GetTypeInfo().Assembly),
Order = ToolbarItemOrder.Primary
});
ToolbarItems.Add(new ToolbarItem
{
IconImageSource = new SvgImageSource(ImageSource.FromResource("MyProject.EmbeddedFiles.Images.test.svg", typeof(App).GetTypeInfo().Assembly), 10,10,true),
Order = ToolbarItemOrder.Primary
});
Neither solution works. My solution based on https://github.com/luberda-molinet/FFImageLoading/issues/1105
What am I missing? Is this even possible?

Extend GCKUICastContainerViewController below the Home Indicator

I'm integrating GoogleCast to my app. Its root view controller is a UITabBarController, with a custom white tab bar.
After I wrapped it with a GCKUICastContainerViewController, the Home Indicator background area became black (and the indicator is white).
How can I make this Container VC extend its child VC (my tab bar controller) below the home indicator?
Note: There is an ugly workaround that I tried, which is to set castContainerVC.view.backgroundColor = .white. This would work if the tab bar was always visible, but some parts of my navigation stack may choose to hide it. When it happens, I'd end with a white Home Indicator area, but whatever color the presented view controller has above the indicator.
extension GCKUICastContainerViewController {
open override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if let window = UIApplication.shared.keyWindow, miniMediaControlsViewController?.view.bounds.height ?? 0 == 0 {
contentViewController?.view.frame = window.frame
} else {
contentViewController?.view.frame = (view.subviews.first! as UIView).frame
}
}
}
Yes, it appears Google wants us to have the GCKUICastContainerViewController as the root view controller. And it looks like it has some layout issue when there is safe area inset at the bottom of the display.
I solved this by changing the view's frame manually in viewDidLayoutSubviews. You can do it with an extension like this
extension GCKUICastContainerViewController {
open override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if let window = UIApplication.shared.keyWindow {
contentViewController?.view.frame = window.frame
}
}
}
This way you will get rid of the space at the bottom of the screen. Works for me.

AmChart export change font color on export

i have i problem and tried different solutions, but no success.
I have an amChartXY chart, which has white labels and legend text is white, but when i want to build custom pdf report, i cannot convert those white text into black.
First i have a function which exports chart to base64 string, and i want there to convert the text color to black, but it won't work.
Here is a code snippet of a menu item, that converts to SVG that is saved to global array object.
menu: [
{
class: "",
label: "Save to draft",
click: function() {
var overrideObject = {
backgroundColor : "rgba(255,255,255,1)",
color : "#000",
legend : {
color : "#000"
}
};
var chartObject = this;
chartObject.capture(overrideObject, function () {
chartObject.toJPG({}, function (base64) {
// charts is global array
charts.push({
name: customName,
chart: base64
});
});
});
}
},
Here the overrideObject is changing the backgroundColor attribute with white ( before is was transparent ) but it's not changing font color. Also i have tried different attributes to add, but nothing seems to work.
Is this possible at capture time ?
Here are some images preview of what i want to accomplish :
AmChart for export isn't that well documented, so any feedback would be welcome
The overrideObject you're passing only accepts the same parameters listed in the list of export settings. If you need to change the appearance of specific elements on the chart, you need to use the reviver callback mentioned in the annotation settings section to selectively apply your modifications. For example, here's how to target the value axis labels:
"export": {
"enabled": true,
"reviver": function(nodeObj) {
if (nodeObj.className === 'amcharts-axis-label' && nodeObj.svg.parentNode.classList.contains('amcharts-value-axis')) {
nodeObj.fill = 'rgba(255,0,0,1)';
}
},
// ...
}
Note that you need to use SVG attributes to change the appearance, so you'll have to set the fill to change the color of the text element.
Codepen demo

Resources